In website operation, friendship links are one of the important ways to enhance website authority, obtain external traffic, and improve user experience.A system that is convenient to manage and can dynamically display friend links will undoubtedly greatly improve operational efficiency.The AnQi CMS is an efficient content management system that provides flexible friend link management features, allowing you to easily display these valuable external resources in the footer or sidebar of your website.
Friend link management in AnQi CMS
First, the management operation of the friendship link is very intuitive. You just need to log in to the AnQi CMS backend management interface, and you can find the "Friendship Link" item in the "Function Management" menu on the left.Here, you can conveniently add, edit, or delete links.Each link can be set with its name, specific URL address, some remarks, and whether it is enablednofollowProperties. These backend settings will directly affect the display effect of the front-end page and the SEO strategy.
Dynamic display: clever use.linkListTemplate Tag
The Anqi CMS template system is designed to be very flexible, drawing on the syntax of the Django template engine, allowing you to dynamically call website data through simple tags. To display the list of friend links you have set up in the background on the website front end, we need to use a special template tag -linkList.
linkListThe tag is used to retrieve all the friendship link data you maintain in the background and provide it to the template in a traversable list format. Its basic usage is{% linkList 变量名 %}For example, you can define it as{% linkList friendLinks %}In this way, all the friend link data will be stored infriendLinksthis variable for your subsequent operations.
due tofriendLinksis an array object containing multiple link information, you need to useforto iterate through each specific content of the friendship link one by one. In the loop, each link item is usually nameditemIt includes various properties of the link, such as:
item.Title: The display name of the link.item.Link: The URL address of the link.item.Remark: The remark information of the link (if filled in on the back-end).item.NofollowA boolean value indicating whether the link has been setnofollowProperty.
Next, you can render this information into an HTML structure, generating clickable links. Considering SEO and user experience, we usually addtarget="_blank"Property, open the link in a new window, and add conditionally based on backend settings.rel="nofollow"Property.
Here is an example of a template code to display a list of friendship links:
{% linkList friendLinks %}
{% if friendLinks %} {# 建议先判断是否有友情链接,避免页面出现空白区域 #}
<div class="friend-links-section">
<h3>友情链接</h3> {# 您可以自定义标题,例如“合作伙伴”、“推荐站点”等 #}
<ul class="friend-links-list">
{% 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 %}
In this code block:
{% linkList friendLinks %}Get friend link data.{% if friendLinks %}the judgment.friendLinksWhether the variable has content, ensure that the entire area is displayed only when there is a link.{% for item in friendLinks %}Iterate through each friend link.{{item.Link}}and{{item.Title}}Output the address and name of the link separately.{% if item.Nofollow == 1 %} rel="nofollow"{% endif %}It will dynamically add links based on the background settings.rel="nofollow"Property, which helps control the weight transfer of the website.target="_blank"Ensure that the link opens in a new tab after clicking, enhancing the user's browsing experience.
Place the友情链接 friendship link at a specific position on the website.
In a website, the footer or sidebar is a common place to display links.The template design of AnQi CMS usually divides these common areas into independent template files.You may need to refer to the topic you are currently dealing withtemplateUnder the directory, find similarpartial/footer.htmlorpartial/sidebar.htmlsuch a file.
You just need to copy and paste the above provided code snippet into the corresponding template file where you want to display the friendship link.After saving and refreshing the website page, you will see the dynamic display of the friend link list set in the background on the website.This modular design allows you to manage links centrally and flexibly control their display at various locations on the website.
If you are using the multi-site management feature of Anqi CMS and want to call the friend link data of other sites on a specific site,linkListLabels also providedsiteIdTo achieve this goal, parameters can be used. For example:{% linkList friendLinks with siteId="1" %}The link list of the site with ID 1 will be obtained.
In this way, Anqi CMS not only simplifies the maintenance of friendship links, but also provides powerful template tag support, making content display more flexible and diverse.
Frequently Asked Questions (FAQ)
- Why is my website footer/sidebar not displaying the friend links?
- Please check if the link has been added in the 'Function Management' -> 'Friend Links' section of the AnQi CMS backend. If not added, the frontend will not display naturally.
- Secondly, confirm whether you have already
linkListcorrectly pasted the tag code into the corresponding position of the website template (for examplepartial/footer.htmlorpartial/sidebar.html). Please check whether the path of the template file and the code are complete and correct. - If you are using the multisite feature, please check
linkListwhether the tag is specified correctlysiteIdthe parameters to call the target site's affiliate link.
- in the affiliate link.
rel="nofollow"What is the role of the attribute?rel="nofollow"It is an HTML attribute that tells the search engine not to follow this link and not to pass the page authority to the target page of the link.In the context of friend links, it is often used to avoid negative impacts on SEO due to linking to low-quality websites, or when the nature of the link is advertising or user-generated content, to comply with the search engine's **practical guidelines.
- Can I display different groups of friend links in different areas of the website?
linkListThe tag itself does not provide a direct "grouping" parameter in the document. However, you can use the "note" field to classify tags when adding friend links in the background, and display them through templates on the frontend.ifstatement and string judgment (for example{% if item.Remark == "合作伙伴" %}to filter and display.- Another method is to take advantage of the multi-site feature of Anqi CMS. If your friend links are indeed for different themes or purposes, consider managing different sets of friend links under different sites and through
siteIdThe parameter calls the exclusive friends link list of the specific site.