In website operation, friend links are an important way to enhance website weight, increase external traffic, and enhance user trust.AnQiCMS (AnQiCMS) provides convenient features, allowing you to easily display these valuable external links at the bottom of your website.
Step 1: Add and configure the friend link in the background management interface
First, we need to add and manage the friend links in the Anqi CMS backend management system. This is like preparing the content list that you will display on the website.
- Log in to the backend:Log in to the Anqi CMS backend using your administrator account.
- Enter feature management:In the left navigation bar, find and click the 'Feature Management' menu item.
- Select the friend link:In the "Function Management" page, you will see an option called
- Add or edit a link:
- Click the 'Add Friend Link' button to start creating a new link.
- You need to fill in the following information:
- Link Name (Title):This is the name displayed on the website for the link of friendship, it should be concise and clear, usually the name of the other website.
- Link Address (Link):Enter the complete URL address of the other website, for example
https://www.example.com. - Link remark (Remark):Can be a brief description about this link, convenient for your own management, usually not displayed on the front end.
- Is Nofollow (Nofollow):This is an important SEO option. If this option is checked, the link will be added with
rel="nofollow"Attribute, tells the search engine not to track the link passing weight. It is usually recommended to check this box for external友情 links to avoid excessive weight transfer and control SEO risks.
After completing the information entry, click save, your friendship link will be successfully added to the background database.You can repeat this step to add more links, and you can also come back to edit or delete existing links.
Step 2: Call and display the friend link list in the website template
Next, we need to display the友情链接(friendship links) added in the background on the website's front page. This usually involves modifying the website's template files.
Confirm the display location:The friend link list is usually placed in the footer area of the website. In AnQi CMS, the footer content is often in an independent template fragment file, such as
partial/footer.htmlorbash.htmlIf your template uses this common code structure.Use
linkListTags:Anqi CMS provides a special template tag for calling friend links.linkList. This label is very intuitive and can retrieve all the friend link data you have configured on the backend.You can use the following code to add the friend link list to your template file:
{% linkList friendLinks %} {% if friendLinks %} <div class="footer-links"> {# 可以为友情链接列表添加一个容器以便样式控制 #} <h3>友情链接</h3> <ul> {% for item in friendLinks %} <li> <a href="{{item.Link}}" {% if item.Nofollow == 1 %} rel="nofollow"{% endif %} target="_blank">{{item.Title}}</a> </li> {% endfor %} </ul> </div> {% endif %} {% endlinkList %}Let's decode this code:
{% linkList friendLinks %}This is the label called to call the friend link list.friendLinksIt is the variable name you define for this list, and you will access the link data through this variable later.{% if friendLinks %}This is a conditional judgment. It checksfriendLinksDoes the variable have data (i.e., whether the background has added a friend link).This can avoid displaying an empty 'Friend Links' title or a blank area when there are no friend links, enhancing the page's neatness.<div class="footer-links">...</div>This is an HTML structure used to wrap the list of friendship links. You can customize the CSS class for your website design, to control its style and layout.divAdd a custom CSS class to control its style and layout.<h3>友情链接</h3>A simple title, clearly indicating that this part of the content is a friendship link.<ul>...</ul>and<li>...</li>A standard HTML unordered list structure, each<li>contains a friendship link.{% for item in friendLinks %}This is a loop label, it will iterate overfriendLinksEach link data in the variable and name ititem.<a href="{{item.Link}}" ... >{{item.Title}}</a>This is the actual HTML code displayed for the link{{item.Link}}Dynamically outputs the link address set in the background.{{item.Title}}: Dynamically outputs the link name set in the background.{% if item.Nofollow == 1 %} rel="nofollow"{% endif %}: This is a conditional judgment, if the link is set tonofollow, then it will be<a>automatically added in the tag.rel="nofollow"Property.target="_blank"This attribute will open the link in a new window or tab, helping users to stay on your website.
{% endfor %}Loop end tag.{% endif %}End tag for conditional judgment.{% endlinkList %}:linkListThe end tag of the label.
Save and update the cache:After modifying the template file, be sure to save the changes. To ensure that the front-end page reflects your changes immediately, it is recommended that you log in to the Anqi CMS backend, click 'Update Cache' to clear the system cache.
By following these steps, you can elegantly display your friend link list at the bottom of the website built with Anqi CMS.This can effectively manage external links and also help improve the website's SEO performance and user experience.
Frequently Asked Questions (FAQ)
- I added a friend link in the background, but the front page did not display. What could be the reason?There are usually several possible reasons: First, please confirm whether you have added it to the correct template file (such as
footer.htmlorbash.html)linkListLabel code. Next, check for syntax errors, such as spelling mistakes or unclosed tags.Finally, after modifying the template file, please make sure to go to the "Update Cache" feature in the background management interface, clear the website cache, so that the front-end can load the latest template content. - Can the order of the display of friend links be adjusted?In the current friendship link management interface of Anqi CMS, links are usually displayed in the order of addition or default ID order.If you need to customize the sorting, you may need to adjust it individually through the backend editing function, or use the sorting function of the template after obtaining the data (if your template engine version supports it) for secondary processing. Currently
linkListThe tag itself does not provide directorderparameters to control sorting. - Can the友情链接 links be grouped and displayed, such as the "Partners" and "Technical Support" groups?
linkListThe current design of the label is to retrieve the unified list of all友情链接 links from the background, without built-in direct grouping parameters to distinguish the display. If you have a need for grouped display, you can consider two methods:- Method one (recommended):When adding a friendship link in the background, use the 'Link Note' field for marking, such as noting it as 'Partner' or 'Technical Support'. Then, after obtaining all the links in the template, through
ifConditional judgmentitem.RemarkThe content is used to manually group and display. - Method two (advanced):If your business logic is very complex and requires more flexible group management, you can consider using the custom content model or custom field function of AnQi CMS to create a module specifically for "external cooperation" or "partner", and manage and call links with grouping attributes through this module.
- Method one (recommended):When adding a friendship link in the background, use the 'Link Note' field for marking, such as noting it as 'Partner' or 'Technical Support'. Then, after obtaining all the links in the template, through