How to get and display the list of friend links in Anqi CMS?

Calendar 👁️ 65

In website operation, friendship links (also known as friend links) are an important component for improving website authority, increasing external traffic, and promoting interaction between websites.A well-maintained list of friendship links, which not only increases the external links of the website and has a positive effect on SEO, but also provides users with more relevant information and improves the user experience.AnQi CMS knows its importance, provides an intuitive and friendly backend management interface and convenient template calling method, allowing you to easily obtain and display the list of友情链接 links.

Next, we will introduce in detail how to implement this feature in Anqi CMS.


One, backend management: easily configure the link

Firstly, to display the link on the website, we need to add them in the background. The Anqi CMS backend operation is very intuitive:

  1. Log in to your Anqi CMS backend.
  2. Find and click in the left navigation bar“Function Management”.
  3. You will see in the feature management menu“Friendship links”Options, click to enter.

Here, you can add, edit, or delete friend links just like managing other content. Each friend link usually contains the following key information:

  • Link Name (Title)This is the text displayed on the page for the友情链接, for example, 'AnQi CMS official website'.
  • Link AddressThis is the URL of the external website linked by the friendship link. Please ensure the accuracy of the URL, it is best to includehttp://orhttps://.
  • Remark: You can add some internal notes to the link for easy management, these notes are usually not displayed on the front-end page.
  • Whether to setnofollowThis is a very important option. It is recommended to check when the link points to an external website, especially when you cannot fully control the quality of the content or its relevance to your websitenofollowThis tells the search engine not to pass the weight of your website to the linked websites, thereby protecting the SEO health of your website.

Through this interface, you can batch manage your friend links to ensure they always remain up-to-date and of high quality.


II. Front-end Display: Flexible invocation of friend link list

When the friendship link data is ready in the background, the next step is to display them on the front page of the website. Anqi CMS provides a simple and efficient template tag for this:linkList.

The design concept of this tag is to allow you to get the friendship link data configured on the background with the least amount of code. Its basic usage is as follows:

{% linkList friendLinks %}
    {# 在这里编写循环代码来显示友情链接 #}
{% endlinkList %}

Here, friendLinksIs a custom variable name, you can name it according to your preference (for examplelinks/myFriendLinksetc.).linkListThe tag will return a list object containing all friendship link information, you can use a loop to iterate over them one by one.forTo display them one by one.

linkListThe tag usually does not require any additional parameters, it will intelligently obtain all the friendship links under the current site. However, if you are using the multi-site management feature and want to obtain friendship links of a specific site, you can use it additionallysiteIdparameters, for example{% linkList friendLinks with siteId="2" %}.

In the loop, each friendship linkitem(You can customize the loop variable name) includes the following available fields:

  • item.Title: The name of the friendship link.
  • item.Link: The target URL of the friendship link.
  • item.Remark: Note set by the background (usually not displayed directly).
  • item.Nofollow: A boolean value, if checked in the backgroundnofollow, then this value is1Otherwise0. You can dynamically add this value on the front end.rel="nofollow"Property.

Friend link list display code example

Now, let's look at an example code of how to display the friendship link in the template.This is usually placed in the footer (footer.html) or a dedicated page for links (for examplepage/friend-links.html).

{# 假设这是您的模板文件中的某个位置,例如页脚 #}

{% linkList friendLinks %} {# 调用linkList标签,将友情链接数据赋值给friendLinks变量 #}
    {% if friendLinks %} {# 建议先判断friendLinks变量是否存在内容,避免在没有链接时显示空区域 #}
    <div class="friendly-links-section">
        <h3>友情链接</h3> {# 您可以根据需要修改标题 #}
        <ul class="friendly-links-list">
            {% for item in friendLinks %} {# 遍历friendLinks中的每一个友情链接项 #}
            <li>
                <a href="{{ item.Link }}" {# 链接地址 #}
                   {% if item.Nofollow == 1 %} rel="nofollow"{% endif %} {# 根据后台设置的Nofollow属性添加rel #}
                   target="_blank" {# 建议设置为新窗口打开,保留用户在您网站的访问 #}
                   title="{{ item.Title }}{% if item.Remark %} - {{ item.Remark }}{% endif %}"> {# 鼠标悬停时显示链接名称和备注 #}
                    {{ item.Title }} {# 链接的显示名称 #}
                </a>
            </li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}
{% endlinkList %}

Code explanation:

  • {% linkList friendLinks %}: This is a core tag, it retrieves all friend link data from the database and stores it in a namedfriendLinks.
  • {% if friendLinks %}: This is a conditional judgment, iffriendLinksThe variable is not empty (i.e., there are friend links added in the background), so this part of the HTML is rendered to avoid an empty 'Friend Links' title or list on the page.
  • {% for item in friendLinks %}: Loop through.friendLinksEach friendship link in the list, when the loop runs, the data of the current link will be assigned toitemVariable.
  • href="{{ item.Link }}": Set the target URL of the link.
  • {% if item.Nofollow == 1 %} rel="nofollow"{% endif %}: This is a key SEO processing. According to the backgroundNofollowThe value (1 means yes, 0 means no), dynamically adds linksrel="nofollow"Attribute, tells the search engine not to follow this link, which helps avoid weight loss on your website.
  • target="_blank"It is usually recommended to open友情链接 in a new window so that the user's website remains open after clicking on an external link.
  • title="..."To add a link,titleAttribute, when the user hovers over the link, a tooltip will be displayed to enhance user experience.
  • {{ item.Title }}: Display the name of the friendship link.

3. Practical Applications and Optimization Suggestions

  • Select the placement location:Friendship links are usually placed in the footer area of a website or a separate "Friendship Links" page.If your website is heavily dependent on link building for promotion, you can also consider placing a few high-quality links in more prominent positions such as the sidebar.
  • rel="nofollow"The importance of:Pay special attention to the backend settings.nofollowOptions. This is not only part of the SEO strategy, but also a sign of being responsible for your website.When linking to external websites, especially when you cannot fully control the quality of the content on the site, or when the relevance of the other site to your topic is low, it is recommended to check the boxnofollow.
  • Maintain the relevance and quality of the link:Regularly check your friend links to ensure they are still active and relevant to your website's theme.Remove invalid or low-quality links to maintain the health of the friend links list, which is greatly beneficial for the long-term development of the website.

By using AnQi CMS, obtaining and displaying the friend link list is a simple and direct process, allowing you to focus more on website content operation rather than complex coding.Follow the steps and suggestions mentioned above, your website will be able to better utilize the advantages of friendship links.


Frequently Asked Questions (FAQ)

Q1: Why did I add a friend link but it did not display on the website page?

A1: Please check the following points:

  1. Is the template called:Does your website template include:{% linkList friendLinks %}and subsequentforLoop code? If this part of the code is missing, the link will not display.
  2. Link status:Make sure the friend link you added in the background is enabled.
  3. Cache problem:If your website has cache enabled or the browser has cache, please try to clear the AnQi CMS backend cache (find "Update Cache" at the bottom of the left menu in the backend), and refresh the browser or access in incognito mode.

Friendship

Related articles

Does AnQi CMS support the display of mathematical formulas and flowcharts in article content?

In content creation, especially in technical articles, academic papers, or project documents, we often need to present complex mathematical formulas and clear flowcharts to enhance the professionalism and readability of the content.For users of AnQiCMS, this is indeed a very practical need.Then, does Anqi CMS support displaying mathematical formulas and flowcharts in article content?The answer is affirmative, and it is not complex to implement. AnQi CMS provides flexible and diverse content management methods for content creators, one of which is the built-in Markdown editor.

2025-11-08

How to display the single page content of a specified ID in Anqi CMS, such as 'About Us'?

In AnQi CMS, whether it is to display a corporate profile like "About Us" or static content such as "Contact Information", "Terms of Service", the single-page feature is very practical.It allows you to create independent pages that do not belong to any category and provides a flexible way to control the display of these pages. To make the Anqie CMS display the single page content of a specified ID, you will mainly use the built-in template tags and the page management function of the back-end.This makes it very convenient to customize exclusive layouts at any location on the website or for specific single-page websites.

2025-11-08

How does Anqi CMS handle and display remote images, is it downloaded locally or directly referenced?

In website content management, effective image processing is crucial for improving page loading speed, user experience, and even SEO performance.AnQiCMS (AnQiCMS) provides flexible and practical strategies for handling remote images referenced in content, mainly manifested in two ways: downloading them to the local server for management or directly referencing the original link of the remote image.Both of these methods have their own focus, meeting the needs of different operation scenarios.**The core processing mechanism of AnQi CMS for remote images** AnQi CMS encounters remote image links in the content editor

2025-11-08

How to build and display an online comment form and its custom fields in Anqi CMS?

Aqii CMS provides a powerful and flexible online message function, which not only allows you to build a basic contact form, but also enables you to customize various fields according to business needs, thereby collecting more accurate user feedback.Below, we will explore how to easily build and display these comment forms in Anqi CMS. ### In AnQi CMS backend, configure the message form and custom fields To start building your online message form, you first need to log in to the AnQi CMS backend interface. 1. **Access the Message Management Module:** Log in to the backend after

2025-11-08

How does the "Full Site Content Replacement" feature of AnQi CMS affect the final display of published content?

In the daily operation of website management, content updating and maintenance is a continuous and crucial aspect.AnQiCMS (AnQiCMS) understands this need and therefore provides a powerful and efficient feature - 'Full Site Content Replacement'.This feature is not a simple modification of the front-end display, but a deep and immediate modification at the database level of published content, which has a direct and comprehensive impact on the final display effect of the website content.What is the "site-wide content replacement" feature?The "All-site Content Replacement" feature of Anqi CMS, as the name implies

2025-11-08

How to display different content blocks based on conditions in the AnQi CMS template?

In AnQi CMS template design, displaying or hiding content blocks based on different conditions is a key ability to achieve dynamic website effects and enhance user experience.Using the built-in template syntax and rich tag features, we can easily build flexible and versatile pages that respond to different situations.The Anqí CMS template engine adopts a syntax similar to Django, which makes conditional judgment and loop control very intuitive and easy to learn.

2025-11-08

How to implement multi-condition filtering display of article lists (such as by price, region) in Anqi CMS?

In modern website operations, users' demand for content filtering is growing increasingly.Whether it is to find products at a specific price or to inquire about activities in a certain area, an article list that supports multi-condition filtering can greatly improve user experience and content reach efficiency.AnQiCMS (AnQiCMS) leverages its flexible content model and powerful template tags to provide website operators with a convenient solution for implementing such complex filtering functions.

2025-11-08

How to set the website Logo, filing number, copyright information and other global display content in Anqi CMS?

The website's logo, filing number, copyright information, these seemingly trivial elements are the foundation of the website's professional image, brand recognition, and compliance.In Anqi CMS, managing these global display contents is much more convenient than imagined, without the need for complex code modifications, just by performing intuitive backend operations, you can easily create a professional and standardized website facade.This article will guide you step by step on how to efficiently set up and use these important global information in Anqi CMS.

2025-11-08