Friend links are an important part of website optimization and user experience, they not only help your website get a better ranking in search engines, but also provide visitors with more valuable resources, and are also a bridge to establish contacts with industry partners.In AnQiCMS, managing and displaying friend links is a straightforward and flexible operation, allowing you to easily configure these important external connections for your website.
Manage friend link list in the background
To start managing friend links, you need to log in to the AnQiCMS backend.All auxiliary functions are concentrated in the 'Function Management' menu.Click to enter and you will find the option of "Friendship Link Management".
Here, you can easily add, edit, or delete友情链接 (friend links). When you decide to add a new友情链接 (friend link), the system will require you to fill in some key information:
- Link name:This is the name of your friend link partner website displayed on your site, for example, 'AnQi CMS Official Website.'
- Link address:That is the complete URL of the other website, for example,
https://en.anqicms.com. - Note:This is a convenient internal field for you to manage and identify these links, which is usually not displayed on the front end to users. You can write down the characteristics, contacts, and other information of the other website.
- Nofollow:This is an important option for SEO. If you check this option, it means you are telling the search engine not to track the weight of this link, usually used to avoid passing weight to uncertain content, advertising nature, or links you do not fully trust.This is an option that a responsible website administrator should consider, reasonable use helps maintain the SEO health of your website.
By filling out these fields, you can build a clear and organized friend link library for the website.
Front-end display of friend link list
After setting up the friendship link in the background, the next step is to display them on your website's front page. AnQiCMS provides a special template tag for this—linkListIt can flexibly obtain the friend link data configured in your background.
It should be used in the template.linkListTag, you will usually write it like this:
{% linkList friendLinks %}
{% if friendLinks %}
<div class="friendly-links-section">
<h3>友情链接</h3>
<ul class="friendly-links-list">
{% for item in friendLinks %}
<li>
<a href="{{item.Link}}" {% if item.Nofollow == 1 %}rel="nofollow"{% endif %} target="_blank">
{{item.Title}}
</a>
{% if item.Remark %}
{# 备注通常不显示在前台,但如果需要,可以这样使用 #}
<span class="link-remark">{{item.Remark}}</span>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endlinkList %}
In this code block,{% linkList friendLinks %}Will fetch all the friend links from the background and store them in a list namedfriendLinksTo avoid displaying an empty title or list when there are no friend links, we first use{% if friendLinks %}Made a judgment.
Then, through aforloop, you can iterate overfriendLinksover each element in the listitem(which is every friend link). Eachitemcontains the following available fields:
item.Title: The display name of the友情链接 (friendship link).item.Link: The URL of the友情链接 (friendship link).item.Remark: Notes filled in the back-end, usually not displayed on the front-end, but you can choose to display them as needed.item.Nofollow: A numerical value, if it is1then it indicates that the link has been marked asnofollow, you can use this value to conditionally for<a>tagsrel="nofollow"Property, this is very important for SEO practice. At the same time, in order to provide a good user experience, we usually add properties for external links.target="_blank"Property, so that they can open in a new window.
If you are running a multi-site project and want to display links to other sites on a specific site, you canlinkListthe tag withsiteIdparameters, for example{% linkList friendLinks with siteId="2" %}This will call the friend link list of the site with ID 2.
By using AnQiCMS's simple and efficient backend management and flexible and powerful template tags, setting up and displaying friend links becomes effortless. You can focus on content creation and the overall operation of the website without worrying about these details.
Frequently Asked Questions (FAQ)
1. What is the role of 'Nofollow' in the友情链接 management? When should I check it?
“Nofollow” is an HTML attribute used to inform search engines not to pass on the link weight (PageRank) of your website to the target link.This means you do not acknowledge or guarantee the content of the link. You should consider checking the 'Nofollow' option in the following cases:
- Paid links or advertisements:Any link that is an advertisement or obtained through sponsorship should use 'Nofollow'.
- User-generated content:For example, links in comments or forums, you cannot fully control the quality and relevance of their content.
- Uncertain or low-quality links:If you have doubts about the quality, authority, or relevance of an external website to your site, using "Nofollow" can protect your site.
Using "Nofollow" reasonably helps maintain the SEO health and credibility of your website.
2. Can I display友情链接 (friend links) in multiple different locations on the website (such as the footer and sidebar)?
Yes, you can. AnQiCMS'linkListTemplate tags can be used multiple times in your template file. Just insert the above in any template area where you want to display the friend link (such asfooter.htmlorsidebar.htmlin the code snippet file) above.linkListThe code segment is ok. Each call will retrieve the list of friend links from the background, and you can adjust the style according to the layout needs of different positions.
What will be displayed on the front-end page if I have not added any friendship links in the background?
If you have not added any friendship links in the background, then{% linkList friendLinks %}Tags retrieved from comments.friendLinksThe list will be empty. Because we have added it in the sample code{% if friendLinks %}This judgment, when there is no friendship link on the front page, includes the title of 'Friendship Link' and the entire listdiv.friendly-links-sectionNo area is rendered, thus avoiding the display of an empty or unattractive area, ensuring the page's neatness.