How to display the friend link list of the website in AnQiCMS template?

Calendar 👁️ 53

As an experienced CMS website operation personnel of AnQi, I fully understand that in website operation, friendship links are not only the embodiment of external resource cooperation, but also an important part of SEO optimization and user experience construction.AnQiCMS has always been committed to providing simple and efficient solutions in content management and template integration, and displaying the list of friendly links is no exception.

Now, I will introduce to you how to elegantly display the list of friend links on the AnQiCMS template.

In modern website operation, friendship links (also often referred to as "partners" or "recommended sites") play a crucial role in connecting websites to external resources, enhancing search engine visibility, and enriching user navigation.A well-designed, easy-to-manage and display area for friendship links, which can effectively increase the authority of the website, improve the external link structure, and provide users with more valuable information.AnQi CMS is an efficient content management system that fully considers this need, providing built-in functions and template tags to allow website operators to easily implement the display of friendship links.

Understand AnQiCMS's friend link management mechanism

The Anqi CMS integrates the management of friend links into its "Function Management" module on the backend. Here, you can add, edit, and delete friend links, including setting the link name, URL address, notes, and whether to addnofollowProperty. Built-in system.linkListTemplate tags are the core tools for front-end templates to retrieve these background data.This label is designed to be intuitive and easy to use, conforming to the syntax style of the Django template engine, even beginners in template development can quickly get started.

Steps to display the friend link list in the template.

To display the friend link list in the AnQiCMS template, you mainly need to do two things: determine the display location, and use the correct template tags.

Step 1: Select the appropriate template file and display location

Friendship links are usually placed at the footer (footer), sidebar (sidebar) or an independent "friendship links" page on a website.

If you want to display友情链接 at the bottom of all pages, you may need to edit the template directory used for the common partbash.htmlfile, or define the footer in your themepartial/footer.htmlThese files are usually accessed by other pages.{% include %}references.}

If the link to friendship is only displayed on specific pages, such as the homepage, then you can edit.index/index.htmlfile.

Find the area of code you decide to display the friend link.

Step two: uselinkListTag to get and traverse the friend link data.

AnQiCMS providedlinkListThe tag is used specifically to retrieve friend link data from the background database. The usage of this tag is very concise.

First, you need to use{% linkList 变量名 %}Define a variable that will store the collection of all友情链接 For example, we can name itfriendLinks.

{% linkList friendLinks %}
    {# 在这里处理 friendLinks 变量 #}
{% endlinkList %}

OncefriendLinksThe variable is defined, it will be an array object containing all the friendship link information. Next, you need to useforLoop to traverse this array and display the details of each friendship link one by one.

In each loop,itemThis variable represents an independent friendship link object, it contains the following available fields:

  • item.Title: The display name of the友情链接 (friendship link).
  • item.Link: Friend link URL address.
  • item.Remark: Optional remark information for the friendship link.
  • item.NofollowA boolean value (or 1/0), indicating whether the link should be addedrel="nofollow"Property.

The following is an example of the complete code for displaying a list of friendship links:

{% linkList friendLinks %}
    {% if friendLinks %} {# 检查是否存在友情链接,避免在没有链接时显示空标题或区域 #}
    <div class="footer-links">
        <h3>友情链接</h3>
        <ul class="friend-links-list">
            {% for item in friendLinks %}
            <li class="friend-link-item">
                <a href="{{ item.Link }}" {% if item.Nofollow == 1 %}rel="nofollow"{% endif %} target="_blank" title="{{ item.Remark }}">
                    {{ item.Title }}
                </a>
            </li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}
{% endlinkList %}

In this code block:

  1. {% linkList friendLinks %}The tag is used to retrieve all the友情链接 configured in the background and assign it tofriendLinksVariable.
  2. {% if friendLinks %}Ensure that the entire friend link area is rendered only when there is a friend link present, to prevent the page from appearing blank or with meaningless titles.
  3. <h3>友情链接</h3>and<ul>/<li>The HTML tags are used to build the structure of a list and provide a title. You can adjust these HTML structures and CSS classes according to your website design.
  4. {% for item in friendLinks %}Loop throughfriendLinksEach friendship link in the array.
  5. <a href="{{ item.Link }}" ...>Created the actual link.{{ item.Link }}Will output the URL of the friendship link.
  6. {% if item.Nofollow == 1 %}rel="nofollow"{% endif %}This line is very critical. It dynamically adds links based on the backend settings.rel="nofollow"Properties. This is particularly important for SEO management, as it can control the transmission of link weight and avoid unnecessary negative impacts.
  7. target="_blank"Properties make the link open in a new tab, enhancing user experience.
  8. title="{{ item.Remark }}"Set the remark from the background as the link hint information.
  9. {{ item.Title }}Display the name of the friendship link.
  10. {% endfor %}and{% endif %}End separatelyforloop andifConditional judgment.

Stylized friendship link

The code provided is the basic HTML structure and does not include any CSS styles.To make the friend link list display beautifully on your website, you need to style it with CSS.You can use the code indiv.footer-links/ul.friend-links-list/li.friend-link-itemAnd class names, define the corresponding styles in your theme CSS file.

For example, you can set the color of the link, font size, adjust the spacing between list items, or align the list items horizontally, etc.

Summary

Provided by Anqi CMSlinkListTemplate tags and concise Django template syntax make it a direct and flexible process to display a list of friendship links on the website frontend.The operation personnel only needs to manage the friend link data in the background, and then integrate the above template code snippet into the corresponding position of the website, and it can be easily implemented.This method not only simplifies the development process, but also provides strong support for website external link management and SEO optimization.


Frequently Asked Questions (FAQ)

How to manage friend links in Anqi CMS backend?

You can log in to the Anqi CMS backend, navigate to the "Function Management" menu, and then find the "Friend Links" option. On this page, you can conveniently add new friend links, edit the names, URLs, notes, and whether to enable existing linksnofollowAttribute, you can also delete the links that are no longer needed.

2. Why do you need to set up friend links?rel="nofollow"?

rel="nofollow"is an HTML attribute used to inform search engines not to consider the link target as an endorsement of the site and not to pass PageRank (page weight). For friendly links, usenofollowAvoid potential SEO negative impacts due to linking to low-quality websites or excessive link exchanges, while maintaining the naturalness and control of external links on the website.The AnQi CMS provides a direct option to set this attribute in the background, making it convenient for operations personnel to manage according to SEO strategies.

3. Can I display different categories of friendship links on different pages?

The current Anqi CMSlinkListThe tag defaults to fetching all the links managed under the "Friend Links" feature module in the background, and does not provide parameters for filtering based on "Group" or "Type". If you have this requirement, you may need to create multiple separate pages in the background (such as "Partner A", "Partner B"), and manually insert the corresponding friend link list content on each page, or customize the development tolinkListAdd logic on the tag to identify different link groups.

Related articles

How to render and process the message form fields in AnQiCMS template?

As an experienced security CMS website operation personnel, I am very clear about the importance of high-quality content and smooth user experience for attracting and retaining users.The feedback form is an important bridge for website interaction with users, and its correct rendering and processing in the template is directly related to whether users can contact us conveniently and quickly.Below, I will elaborate on how to render and process the comment form fields in the AnQiCMS template.### Location of the comment form template file In AnQiCMS, the comment form usually has a dedicated template file to carry its content

2025-11-06

How to integrate and display comment lists in AnQiCMS templates?

Effectively integrating and displaying the comment list in AnQi CMS is crucial for enhancing website user interaction, activating community atmosphere, and obtaining valuable user feedback.As an experienced CMS website operation personnel of an enterprise, I know that high-quality content cannot be separated from the active participation of users.The Anqi CMS provides powerful and flexible template tags, allowing us to easily implement this feature on the front end of the website.### Overview of Comment Functionality and Template File Organization AnQi CMS has built-in comment management functionality, allowing website administrators to review, reply to, and manage user comments

2025-11-06

How to display the Tag list or document list of a specified Tag in AnQiCMS template?

As an experienced CMS website operation personnel of an enterprise, I fully understand the core value of content tags in website content management and user navigation.High-quality tag strategies not only help readers quickly find the information they need, but also effectively improve the organization and SEO performance of website content.Next, I will elaborate on how to flexibly use tags in AnQiCMS templates to display tag lists or document lists under specific tags.### Understand the content tags in AnQiCMS In AnQiCMS, content tags (Tags) are a powerful content association tool

2025-11-06

How to create a multi-condition filtering interface based on document parameters in the AnQiCMS template?

As an experienced security CMS website operator, I know that building an efficient, user-friendly content filtering interface is important for improving user experience and content discoverability.In AnQiCMS, with its flexible content model and powerful template tag system, we can easily create a multi-condition filtering interface based on document parameters.This not only helps readers quickly find the information they need, but also effectively improves the organization and SEO performance of the website content.### The Basics of Creating a Multi-Condition Filter Interface: Understanding Document Parameters In AnQiCMS

2025-11-06

How to generate a pagination navigation with page number control in AnQiCMS template?

Hello! As a senior CMS website operator, I fully understand the importance of high-quality content and user experience.Page navigation is an indispensable part of content-based websites, directly affecting the user's browsing experience and the discoverability of content.In AnQiCMS, generating a pagination navigation with page number control is an intuitive and powerful process. Below, I will elaborate on how to implement this feature in the AnQiCMS template.### In AnQiCMS template, generate pagination navigation with page number control In the content management system

2025-11-06

How to format a timestamp into a readable date and time in the AnQiCMS template?

As an experienced CMS website operation personnel of an enterprise, I know that every detail of user experience is crucial in content management.Clarity in presenting dates and times often directly affects readers' perception of the timeliness and professionalism of the content.Today, I will give a detailed explanation of how to convert those mysterious timestamps into the readable date and time format that we are accustomed to in the AnQiCMS template.

2025-11-06

How to declare and assign variables in AnQiCMS templates for subsequent use?

As an experienced security CMS website operator, I am well aware of the importance of template design for website content display and user experience.Using variables in templates is the key to customizing pages and improving development efficiency.Today, I will elaborate on how to declare and assign variables in the AnQiCMS template, so that you can build and manage your website content more effectively.

2025-11-06

How to include other template files in AnQiCMS templates (such as public header/footer)?

In the daily operation of AnQiCMS, efficient content management is not only reflected in the background data processing, but also cannot do without flexible front-end template design.For website operators, extracting common parts (such as navigation bars, footers, sidebars, etc.) and managing them independently, and introducing them to each page in a unified way, is the key to improving work efficiency, maintaining website consistency, and simplifying maintenance.AnQiCMS provides a powerful and intuitive template introduction mechanism, making this process effortless.AnQiCMS's template system is based on Go language and has borrowed from

2025-11-06