友情链接是网站优化和用户体验的重要组成部分,它们不仅能帮助您的网站在搜索引擎中获得更好的排名,还能为访客提供更多有价值的资源,同时也是与行业伙伴建立联系的桥梁。In AnQiCMS, managing and displaying friend links is an intuitive and flexible operation, allowing you to easily configure these important external connections for your website.

Administrate the friend link list in the background

You need to log in to the AnQiCMS backend to start managing friend links.All auxiliary functions are concentrated under the "Function Management" menu.Click to enter and you will find the option of 'Friendship Links Management'.

Here, you can easily add, edit, or delete友情链接. When you decide to add a new友情链接, the system will ask you to fill in some key information:

  • Link Name:This is the display name of your friend link partner website on your site, for example, 'Anqi CMS Official Website'.
  • Link address:It is the complete URL of the other website, for example,https://en.anqicms.com.
  • Note:This is an internal field for you to manage and identify these links conveniently, 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 a very important option for SEO.If this option is checked, it means you are telling the search engine not to track the weight of this link. This is usually used to avoid passing weight to uncertain content, advertisements, or links you do not fully trust.This is an option that a responsible webmaster should consider, reasonable use helps maintain the SEO health of your website.

By filling out these fields, you can build a clear and well-organized link library for your website.

Front-end display of the link list

After setting up the friend link in the background, the next step is to display them on the front page of your website. AnQiCMS provides special template tags for this.linkListIt can flexibly retrieve the friendship link data configured in your background.

To use it in the templatelinkListYou will usually write the tag 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,{% linkList friendLinks %}Will fetch all the friend links from the background, and store them in a list namedfriendLinks. To 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 overfriendLinksin the listitem(which is every friendship link). Eachitemcontains the following available fields:

  • item.Title[The display name of the friendship link].
  • item.Link: 友情链接的URL。
  • item.Remark: 后台填写的备注信息,通常不直接在前台显示,但您可以根据需要选择展示。
  • item.Nofollow: 一个数值,如果为1This indicates that the link has been marked asnofollowYou can use this value to conditionally set<a>Label addrel="nofollow"Properties, this is very important for SEO practices. At the same time, in order to provide a good user experience, we usually addtarget="_blank"Properties, so that they can open in a new window.

If you are running a multi-site project and want to display links from other sites on a specific site,linkListtag.siteIdparameters, such as{% linkList friendLinks with siteId="2" %}This will call the friend link list of the site with ID 2.

With the concise and efficient background management and flexible and powerful template tags of AnQiCMS, the setup and display of friendly links become effortless. You can focus on content creation and the overall operation of the website without worrying about these details.


Common Questions (FAQ)

1. What is the role of 'Nofollow' in the '友情链接管理' (Friendship Link Management) and when should I check it?

“Nofollow” is an HTML attribute that tells search engines not to pass the link weight (PageRank) of your website to the target link.This means that you do not acknowledge or guarantee the content of the link.

  • Paid links or advertisements:Any link that is an advertisement or obtained through sponsorship should use “Nofollow”.
  • User-generated content:For example, links in comment sections or forums, you cannot fully control the quality and relevance of their content.
  • Uncertain or low-quality links:If you have any doubts about the quality, authority, or relevance of an external website to your own, using 'Nofollow' can protect your website.

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'slinkListThe template tag can be used multiple times in your template file. Simply insert the above in any template area where you want to display the link (for examplefooter.htmlorsidebar.htmletc. code snippet file) as neededlinkListThe code segment is used. Each call will retrieve the background friend link list, and you can adjust the style according to the layout needs of different positions.

3. What will be displayed on the front-end page if I do not add any friendship links to the backend?

If you do not add any friendship links to the backend,{% linkList friendLinks %}the tags you getfriendLinksThe list will be empty. As we added nothing in the sample code{% if friendLinks %}This judgment, when there is no friend link on the front page, includes the title 'Friend Links' and the entire listdiv.friendly-links-sectionThe area will not be rendered, thus avoiding the display of an empty or unattractive area, ensuring the page's cleanliness.