Manage and display friend links in the AnQi CMS, which can not only help the website increase the richness of external connections, but also is an essential part of precise operation in SEO optimization. Especially how to flexibly control according to needsnofollowAttributes are crucial for maintaining the health of website links and for the transmission of weight. Anqi CMS provides intuitive and powerful functions that allow us to easily achieve these goals.
In the Anqi CMS backend, configure the friend link
Firstly, all the friend links displayed on the front-end cannot be separated from the detailed configuration on the back-end.In the management interface of AnQi CMS, you can find the "Friend Links" module under "Function Management.This is the place where you can centrally manage all external collaboration links.
When you add or edit a friend link, you will see the following key fields:
- Link nameThis is the name displayed on the front end for the friendship link, such as 'AnQi CMS Official Website'.
- Link AddressThe complete URL pointing to the target website, like
https://en.anqicms.com. - Link NoteAn internal note information, for your reference on the purpose or partner of this link, this note is usually not displayed on the front end.
- Link nofollowThis option is particularly important. It is a checkbox that allows us to control whether to inform the search engine that this link should not pass the weight of this site, and also not recommended for search engine spiders to track.
Selecting the “nofollow” link option means that, during frontend rendering, the<a>tag will automatically addrel="nofollow"属性。这对于控制网站的SEO链接权重分布、避免不必要的权重流失,或者表明某个链接并非本站的强力推荐,具有非常实际的意义。
Flexibly display friend links on the website front-end
After managing the background data well, the next step is to display these friend links on the website page. The template system of Anqi CMS provideslinkListTags, which can help us easily retrieve the data of friend links configured in the background.
通常,我们会将友情链接放在页脚或专门的友情链接页面。以下是一个基本的模板代码示例,展示了如何获取并循环显示友情链接:
{% linkList friendLinks %}
{% if friendLinks %}
<div>
<h3>友情链接:</h3>
<ul>
{% for item in friendLinks %}
<li><a href="{{item.Link}}" target="_blank">{{item.Title}}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endlinkList %}
In this code block:
{% linkList friendLinks %}Will load all friend link data into a namedfriendLinks.{% if friendLinks %}Determine if there is friend link data, to avoid displaying an empty title when there are no links.{% for item in friendLinks %}Iterate through each friend link,itemThe variable represents the current loop's link data.{{item.Link}}and{{item.Title}}Respectively obtain the address and name of the link.target="_blank"is a commonly used HTML attribute that allows links to open in a new window or new tab, enhancing user experience.
add cleverly according to needsnofollowProperty
Now, let's address the core issue: how to dynamically add friend links on the front-end based on the backend settingsnofollow属性。正如前面提到的,后台的“链接 nofollow”复选框会影响每个链接的Nofollow属性值。在模板中,我们可以通过判断item.NofollowThe value determines whether to addrel="nofollow".
item.NofollowThe value rule is: if the backend is checkednofollow, its value is usually1; if not checked, it is other values (such as0English").We can utilize this feature, in<a>Add a simple conditional judgment inside the tag.
The following is the modified template code, which includesnofollowConditional judgment of the attribute:
{% linkList friendLinks %}
{% if friendLinks %}
<div>
<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 %}
Through this line{% if item.Nofollow == 1 %} rel="nofollow"{% endif %},we have implemented dynamic control.nofollowIf the background has selected a certain link'snofollowoption, then when the front-end renders, the<a>label of the link will automatically includerel="nofollow"Otherwise, it would not be included. This flexible design allows website operators to precisely manage the attributes of each link based on specific cooperation agreements or SEO strategies.
Through the features provided by Safe CMS, managing website友情链接 (friend links) becomes both efficient and in line with SEO practices.Whether it is to maintain the external image of the site or to carry out fine-grained link weight control, Anqi CMS provides solid technical support.
Common Questions and Answers (FAQ)
Q1: Why does the website front-end not display the friend link I set in the background?A1: First, please check if you have used the front-end template file correctly.linkListLabel, as well as whether the loop within the label is traversed correctlyfriendLinksVariable.其次,confirm whether the friendship link you added to the background has been enabled, and there are no other conditions (such as custom template logic) that prevent it from displaying.You can use the browser developer tools to check the HTML source code of the page to see if there is any link data output, thereby determining whether it is a backend configuration issue or a frontend template rendering issue.
Q2:rel="nofollow"What specific role does the attribute play? When should I use it?A2:rel="nofollow"属性是告诉搜索引擎不要跟踪此链接,并且不要将任何“链接权重”或“排名信号”从您的网站传递给目标网站。这通常在以下情况使用:
- Paid link or advertisementTo comply with search engine guidelines, indicate that these links are sponsored and should not pass weight.
- User Generated Content (UGC)For example, links in comment sections and forum posts, because you cannot fully trust the quality of content posted by users.
- Untrusted or low-quality external linksWhen you need to link to certain content, but have doubts about its quality or authority, and do not want to pass on its weight.
- Friendship LinkBased on the quality of the partner's website and your SEO strategy, selectively add friendly links.
nofollowTo better control the flow of link weight to your website.
Q3: Can I add internal links in the friend links? Does it benefit SEO?A3: In terms of technology, you can add internal links in the友情链接(you can add internal links in the friendship link).However, this is usually not **practical**, and it has limited help for SEO, and may even cause confusion.The main purpose of the友情链接 is to point to external websites, while internal links are mainly through the website's navigation menu, article internal links, sidebar recommendations, and other ways.Placing internal links in the "Friend Links" area may reduce their naturalness and the efficiency of user discovery.Suggest you adopt the conventional internal link strategy to optimize the site structure instead of going through the friendship link module.