How to display the friend link list on the AnQiCMS front-end page?

Calendar 👁️ 70

Friendship links are a way for websites to recommend each other, not only can they increase the number of external links of the website, but also be beneficial for search engine optimization (SEO), and can also provide visitors with more relevant resource entries to improve the user experience.AnQiCMS provides us with a very convenient function for managing and displaying friend links.

Next, we will together learn how to set up friend links in AnQiCMS and display them on the front page of the website.

1. Manage friend links in AnQiCMS backend

In AnQiCMS, managing friend links is very intuitive. You can find the dedicated function module in 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 will usually be an option named "Function Management" or something similar.Click to enter and you will see the item "Friend Links".

After entering the friend link management page, you can:

  • Add a new friend linkClick the "Add" button and 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 "notes" for your own management, and choose whether to add the "nofollow" attribute to the link.The nofollow attribute is very useful for telling search engines not to track this link and not to pass weight, which is a common SEO practice when dealing with some external links.
  • Edit existing links: For the friend links that have been added, you can modify their names, addresses, or Nofollow attributes at any time.
  • Delete the links that are no longer needed.:Easily delete outdated or non-cooperating friendship links.

AnQiCMS's友情链接管理功能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.

Second, display the friend link on the AnQiCMS front-end page

After completing the background friend link settings, we can then proceed to display these links on the front page of the website. In the AnQiCMS template system, we mainly use a name calledlinkListThe tag to get the friend link data.

1. Find the appropriate template file

Friend links are usually placed in the footer, sidebar, or a dedicated friends link page of a website.You can choose or create a corresponding template file for editing according to your website design.For example, if you want to display friend links at the bottom of all pages, you can do so in the global footer template file (such aspartial/footer.htmlorbase.htmlAdd code in the part that contains the footer.

2. UselinkListLabel to retrieve data

Use 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 the core tag, it will retrieve all the link data from the background and store it in a namedfriendLinksIn the variable. You can replacefriendLinksReplace it with any variable name you like.
  • {% if friendLinks %}: This is a conditional judgment, used to check.friendLinksDoes the variable have data. This can prevent the display of 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 %}This is a loop label, it will iterate overfriendLinksEach friendship link data. In each iteration, the current friendship link data will be assigned toitemVariable.
  • <li>...</li>: Each friendship link is usually displayed as a list item (<li>)
  • <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 condition judgment. It will check the current friendship link'sNofollowattribute is1(which is checked in the background as nofollow). If it is1, then it will be<a>the tag withrel="nofollow"Property.
  • target="_blank"This attribute is usually used to open links in a new tab to avoid visitors leaving your website.
  • {{ item.Title }}This will output the current link name, which is the link name you fill in the background.

3. Style beautification

After you add the above code to the template file, you may also need to beautify the display effect of the friend links through CSS to keep it 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.

3. Notes and tips

  • Clear cacheAfter modifying the template file, if the front-end page does not take effect immediately, please remember to clear the AnQiCMS system cache to ensure that the latest template file is loaded.
  • Multi-site SupportIf you have enabled the AnQiCMS multi-site management feature and want to call links from other sites on a specific site, you canlinkListthe tag withsiteIdSpecify the site ID to be called. For example:{% linkList friendLinks with siteId="2" %}.
  • SEO-friendlyFor most link exchanges, especially reciprocal links, it is recommended to check the Nofollow attribute.This helps avoid search engines misjudging as 'buy and sell link' behavior, protecting the SEO health of your website.Only consider not adding Nofollow when you are sure that the link has real recommendation significance for your website and you are willing to pass on weight.

By following these steps, you can easily manage and display friend links on websites built with AnQiCMS, adding more value to your website.


Frequently Asked Questions (FAQ)

Q1: Where can I manage the friendship links?A1: You can find the 'Function Management' 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 displaying?A2: Please check the following points:

1.  **后台是否已添加链接?** 确保您已经在后台添加了友情链接。
2.  **模板代码是否正确?** 确认您已将正确的 `linkList` 标签代码放置在前端模板文件中,并且没有语法错误。
3.  **是否清除了缓存?** 在修改模板文件后,请务必清除AnQiCMS的系统缓存。
4.  **是否有CSS样式覆盖?** 检查CSS文件,看是否有样式将友情链接隐藏或显示为不可见状态。

Q3: How to add a friend link?nofollowAttribute to optimize SEO?A3: When adding or editing a friend link in the AnQiCMS backend, there will be an option for you to choose whether to add properties to the linknofollowAfter checking the option, in the front-end templatelinkListExample code for the{% if item.Nofollow == 1 %} rel="nofollow"{% endif %}tag will automatically generate therel="nofollow"attribute, telling search engines not to follow this link, thereby achieving SEO optimization.

Related articles

How to display the user submitted comment form and its custom fields in AnQiCMS template?

In website operation, collecting user feedback and inquiries is an important link to improve service quality and understand user needs.AnQiCMS (AnQiCMS) provides a flexible and powerful message management function, allowing you to easily display a message form in the front-end template and support custom fields to meet the information collection needs of different business scenarios.To implement dynamic display of user submitted comment forms and custom fields in AnQiCMS templates, we mainly use a core tag: `guestbook`

2025-11-08

How to display a list of user-submitted comments on a website and handle the review status?

In website operation, user comments are an important element for building a community, obtaining feedback, and enhancing content interaction.For friends who use AnQiCMS (AnQiCMS) to build and manage websites, efficiently displaying user comments and managing their review status is a key factor in ensuring the quality of website content and user experience.The AnQiCMS provides very flexible and practical functions for this.

2025-11-08

How to correctly render Markdown content (including formulas, flowcharts) as HTML display in AnQiCMS?

AnQiCMS has always been committed to providing efficient and flexible solutions in content display, especially for the increasingly popular Markdown format in modern content creation, which includes complex content with mathematical formulas and flowcharts. AnQiCMS also provides a comprehensive support mechanism to ensure that these contents can be correctly parsed and beautifully presented on the web. To achieve the correct rendering of Markdown content (including formulas and flowcharts), it mainly involves two aspects: the first is the internal handling of Markdown text by the AnQiCMS system...

2025-11-08

How do custom fields of the content model (such as radio, checkbox, text) display on the front-end page?

AnQi CMS: Let the custom content model fields shine in the front-end When using AnQi CMS to manage website content, we often encounter such needs: the standard content structure can no longer fully meet the display of specific information.For example, a product page may need to display its "color options", "size range", or "stock status", etc.At this time, the flexible content model and custom field function of Anqi CMS are particularly important, as it allows us to expand content attributes based on the uniqueness of our business.

2025-11-08

How to use AnQi CMS to realize personalized display of different content models (such as articles, products)?

AnQi CMS is an efficient and customizable content management system, one of its core advantages is the flexible content model.This provides website operators with great freedom, allowing us to design unique structures and display methods for various content types such as 'articles', 'products', etc., thus realizing the personalized presentation of website content.Next, we will delve into how to take advantage of the powerful functions of AnQi CMS to achieve personalized display of content models.Understanding the content model of Anqi CMS

2025-11-08

How to configure and display multilingual website content in AnQi CMS?

AnQiCMS is dedicated to helping users easily meet the needs of global content promotion. It has built-in multilingual support functions, allowing you to flexibly configure and display different language versions of website content.No matter if you want to provide translations for static text in templates or create independent language versions for articles, products, and other core content, AnQi CMS offers intuitive and powerful tools.Next, we will explore how to configure and display multilingual website content in Anqi CMS.### The First Part

2025-11-08

How to optimize the setting of website URL static rules to enhance content display effect and SEO ranking?

In website operation, URL (Uniform Resource Locator) is not only the path for users to access the page, but also an important clue for search engines to understand the content and structure of the website.A well-optimized URL structure plays a crucial role in improving content display and SEO ranking.AnqiCMS (AnQi CMS) takes full consideration of SEO-friendliness in its design, providing flexible and powerful static rule management functions, allowing us to easily create beautiful and SEO-friendly URLs according to the needs of the website.Why do websites need static URLs

2025-11-08

How to customize the Anqi CMS template to meet the unique layout requirements of the website content?

In the digital age, a unique and functional website layout is the core element to attract users and convey brand information.AnQiCMS (AnQiCMS) is an enterprise-level content management system based on the Go language, which provides great flexibility to users with its efficient and customizable features, allowing you to easily create websites that meet specific content layout requirements.To fully utilize the powerful capabilities of AnQi CMS, custom templates are the key to personalized design.This not only involves visual beauty, but also concerns how to efficiently organize and display your website content.

2025-11-08