In AnQiCMS, managing and displaying friend links is very important for improving the website's search engine optimization (SEO) performance, increasing the number of external links, and promoting traffic interflow between websites.AnQiCMS as a fully functional content management system, provides intuitive backend operations and flexible template tags, allowing you to easily display a list of friend links on your website.

1. Manage friend links in AnQiCMS backend

First, you need to add and manage friendship links in the AnQiCMS backend. The system provides a dedicated module to handle this requirement, and the process is very simple:

  1. Log in to the backend:Log in to the AnQiCMS backend management system using your administrator account.
  2. Navigate to the friend link management:In the left menu bar, find and click the "Function Management
  3. Add or edit friendship link:
    • On the friendship link management page, you can view all the friendship links that have been added.
    • Click the "Add友情链接" button, you will see a form that requires you to fill in the relevant information for the friendship link, such as:
      • Link Name (Title):This is the text displayed by the friendship link, which is usually the name of the other website.
      • Link Address (Link):The complete URL address of the other website, make sure to end withhttp://orhttps://At the beginning.
      • Remark (Remark):Can fill in some internal remarks information, which will not be displayed on the front end.
      • Nofollow:This is an important SEO attribute. If you do not want to pass the weight of your website to the other website, it is recommended to check this option. It will be added in the link.rel="nofollow"Property.
    • Fill in the details and click Save. You can also edit or delete existing friendship links at any time.

Part two: Display the friendship links list in the website template.

Completed the backend friend link configuration, next is to display them on the website frontend.AnQiCMS uses a syntax similar to the Django template engine, which can be easily implemented with specific template tags.

  1. Get to knowlinkListTags:AnQiCMS provides a special link forlinkListTemplate tag. This tag is used to extract all configured friendship link data from the background database. Its basic usage method is:{% linkList friendLinks %}...{% endlinkList %}

    HerefriendLinksIs a variable name, you can name it arbitrarily, and the system will assign the data queried from the friendship link to this variable in the form of an array.

    linkListThe tag supports an optional parametersiteIdIf you are using the AnQiCMS multi-site management feature and want to call the friend links under a specific site, you can do so bysiteId="X"Specify (where X is the site ID). For single-site users, this parameter is usually not set.

  2. Traverse the friend link data:Once you pass throughlinkListAfter the tag retrieves the friend link data, it can be used.forto loop throughfriendLinksArray, display the detailed information of each friendship link one by one. Inside the loop,itemThe variable represents each friendship link object being traversed, which contains the following common fields:

    • item.Title: Friend link name.
    • item.Link: Friend link URL address.
    • item.Remark: Friend link remark information (usually not displayed on the front end).
    • item.Nofollow: A boolean value (1indicating yes,0Indicates no, indicating whether the link containsnofollowProperty.
  3. Write template code:The following is a complete template code example showing how to elegantly list friendship links on your website:

    {% 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 %} {# 根据后台设置添加nofollow属性 #}
                   target="_blank" {# 建议新窗口打开,提升用户体验 #}
                   title="{{item.Title}}"> {# 鼠标悬停显示链接名称 #}
                   {{item.Title}}
                </a>
            </li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}
    {% endlinkList %}
    

    Code description:

    • {% linkList friendLinks %}Get all friend links and assign to:friendLinksVariable.
    • {% if friendLinks %}This is a very practical judgment, only when there are friendship links, will the title and list of 'Friendship Links' be displayed, to avoid blank titles when there are no links.
    • <h3>友情链接</h3>and<ul class="friend-links-list">These are HTML structures and CSS classes, you can adjust them according to your website design.
    • {% for item in friendLinks %}Loop through each link.
    • href="{{item.Link}}"Set the link address.
    • {% if item.Nofollow == 1 %} rel="nofollow"{% endif %}:According to the backend settings, dynamically add links tonofollowProperty.
    • target="_blank":Open the friend link in a new tab to improve user browsing experience.
    • title="{{item.Title}}"When the user hovers over the link, display the link name to increase accessibility.
    • {{item.Title}}Display the text of the friend link.

Third, place the template code in the appropriate position.

You usually place this link template code at the footer, sidebar, or a dedicated links page of the website.

  • Footer (Footer):If your template has a common footer file (for examplepartial/footer.htmlorbash.html), you can put this code in it. This way, all pages will automatically display the links.
  • Sidebar (Sidebar):Similarly, if your website has a sidebar template file (for example), you can also place it there.partial/sidebar.html), you can also place it there.
  • Independent page:You can create a separate page to display all the friendship links.Create a new page in the 'Page Resources' -> 'Page Management' section of the AnQiCMS backend, and embed the above template code in the content or custom template of that page.

Using AnQiCMS providedincludetags, you can flexibly insert these code snippets into different positions on the website. For example, in your main template file, you can use{% include "partial/footer.html" %}Introduce a footer with友情 links.

By following these steps, you can easily manage and display the friend link list in AnQiCMS, which not only helps your website better promote externally, but also provides your visitors with richer navigation information.


Frequently Asked Questions (FAQ)

Why isn't the added friendship link displayed on the front page?

Answer:In this situation, you can check from several aspects.Firstly, please make sure you have added the link in the AnQiCMS background "Function Management" -> "Friend Links".{% linkList friendLinks %}and{% for item in friendLinks %}This code is called.Finally, please try to clear the website cache (there is a "Update Cache" button at the bottom of the left menu in the background), because the system may cache old page content, which may cause the new added links to not be displayed in time.

Question:rel="nofollow"What is the role of properties, should I add them to the friendship link?

Answer: rel="nofollow"The attribute tells the search engine not to pass the weight of your website to the linked website. In SEO practice, when you link to an external website but do not want the search engine to consider that you are 'guaranteeing' or 'recommending' the website, you will usually usenofollow. Regarding friend links, especially those over which you have no control over the quality of content