Friendship links are a way for websites to recommend each other, which not only increases the external links of the website and is beneficial for search engine optimization (SEO), but also provides visitors with more access points to relevant resources, enhancing the user experience.AnQiCMS provides a very convenient function for us to manage and display friendly links.
Next, we will together learn how to set up友情链接 in AnQiCMS and display it on the front page of the website.
一、In AnQiCMS background management friend links
In AnQiCMS, managing friend links is very intuitive. You can find a dedicated function module on the backend interface to add, edit, and manage your friend links.
First, log in to your AnQiCMS backend management system.In the left navigation menu, there is usually an option named "Function Management" or something similar.Click to enter and you will see the item "Friend Links
Enter the friend link management page, and you can:
- Add a new friend linkClick the “Add” button, enter the “Link Name” (i.e., the text displayed on the website) and the “Link Address” (i.e., the URL the friendship link points to).In addition, you can also fill in "notesThe Nofollow attribute is very useful for telling search engines not to track this link and not to pass any weight, which is a common SEO practice when dealing with some external links.
- Edit existing link: For the friend links that have been added, you can modify their names, addresses, or Nofollow attributes at any time.
- Delete links that are no longer needed: Easily delete outdated or no longer cooperative friendship links.
AnQiCMS's friend link management feature not only supports manual addition but also provides an API interface, convenient for users who need to perform batch operations or integrate with other systems for management, which greatly improves operational efficiency.
English, in AnQiCMS front-end page display friend links
Completed the background friendship link setting, then we can start to display these links on the front page of the website. In the AnQiCMS template system, we mainly use a template namedlinkListThe label to obtain the friend link data.
1. Find the appropriate template file.
Friendship links are usually placed at the footer, sidebar, or a dedicated friendship links page of a website.You can choose or create a corresponding template file for editing according to your website design.partial/footer.htmlorbase.htmlAdd code in the part containing the footer).
2. UselinkListLabel data acquisition
Use it in the template file you have selected.linkListTags can easily retrieve all added friendship links. Here is a basic usage example:
{% linkList friendLinks %}
{% if friendLinks %}
<div class="friend-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 %}
Code Explanation:
{% linkList friendLinks %}This is a core tag, it will fetch all the friend link data from the background and store these data in a variable namedfriendLinks. You can replacefriendLinkswith any variable name you like.{% if friendLinks %}:This is a conditional judgment, used to checkfriendLinksAre there data in the variable. This can avoid displaying an empty "Friend Links" area on the page when there are no friend links, keeping the page tidy.<div class="friend-links">...</div>This is an HTML structure, you can add a container and style class to the friend link list according to your own CSS style.{% for item in friendLinks %}English: This is a loop tag, it will iterate overfriendLinksThe data of each friendship link. In each loop, the current friendship link data will be assigned toitema variable.<li>...</li>: Each friendship link is usually taken as a list item<li>) displayed.<a href="{{ item.Link }}" ...>This is the core part of the link.{{ item.Link }}It will output the current link address, which is the 'Link Address' you filled in the background.{% if item.Nofollow == 1 %} rel="nofollow"{% endif %}This is a very important conditional judgment. It checks the current friendship link'sNofollowattribute is1(i.e., if nofollow is checked in the background). If it is1in the background.<a>tag.rel="nofollow"properties.target="_blank"This property is usually used to open links in a new tab, preventing visitors from leaving your website.{{ item.Title }}This will output the current link name, which is the 'Link Name' you filled in the background.
3. Style beautification
After you add the above code to the template file, you may also need to use CSS to beautify the display effect of the link, so that it remains consistent with the overall style of your website.For example, you can adjust the font size, color, spacing of list items, or arrange them in multiple columns, etc.
English, Precautions and Tips
- Clear cacheEnglish: After modifying the template file, if the front-end page does not take effect immediately, please remember to clear the system cache of AnQiCMS to ensure that the latest template file is loaded.
- Multi-site support:If you have enabled the multi-site management feature of AnQiCMS and wish to call other site's friendship links on a specific site,
linkListtag.siteIdParameters to specify the site ID to be called. For example:{% linkList friendLinks with siteId="2" %}. - SEO-friendly
You can easily manage and display friend links on the website built with AnQiCMS, adding more value to your site.
Common Questions (FAQ)
Q1: Where can I manage the link of friendship?A1: You can find 'Friend Links' in the left navigation bar of the AnQiCMS backend management interface, and then click to enter the 'Friend Links' page for management.
Q2: Why is my friend link not showing?A2: Please check the following:
1. **后台是否已添加链接?** 确保您已经在后台添加了友情链接。
2. **模板代码是否正确?** 确认您已将正确的 `linkList` 标签代码放置在前端模板文件中,并且没有语法错误。
3. **是否清除了缓存?** 在修改模板文件后,请务必清除AnQiCMS的系统缓存。
4. **是否有CSS样式覆盖?** 检查CSS文件,看是否有样式将友情链接隐藏或显示为不可见状态。
Q3: How to add a friend link?nofollowWhat attributes should I use to optimize SEO?A3: When adding or editing a friend link in the AnQiCMS background, there will be an option for you to choose whether to add properties to the linknofollowAfter checking the option, the front-end template willlinkListLabel example code ({% if item.Nofollow == 1 %} rel="nofollow"{% endif %}) will automatically generate the linkrel="nofollow"attribute, telling search engines not to track this link, thus achieving SEO optimization.