How to retrieve and display the list of友情链接 configured in the background?

Calendar 👁️ 55

As a senior security CMS website operator, I fully understand the importance of efficient content management and front-end display to the success of the website.Friend links are an important part of website external cooperation and SEO optimization, and their convenient acquisition and display methods are an indispensable part of daily operation.Now, I will explain in detail how to obtain and display the list of friend links configured in the AnQiCMS backend.

Anqi CMS: Efficient management and display of backend friend links list

Friend links, as an important part of the construction of website external links, can not only improve the effect of search engine optimization (SEO), but also provide users with more navigation to relevant resources.In AnQiCMS, we fully understand its value and therefore provide a set of intuitive and powerful features to help website operators easily manage and display these valuable links.

On the AnQiCMS backend management interface, you can navigate to the "Function Management" under the "Friend Link" module to centrally manage the friend links.Here you can conveniently add new friendship links, including setting the link name, URL address, remarks information, and whether to add the Nofollow attribute.This centralized management approach ensures that all友情links can be maintained in one place, greatly enhancing management efficiency, and also supports batch operations through the API interface, meeting the needs of advanced users and multi-site management.

Displaying the friendship links configured on the background to the front page of the website is a key step to attract users and pass on SEO value. AnQiCMS provides speciallinkListTemplate tags make this process simple and clear. You just need to use this tag in the template file where you need to display the friend links to easily call the background data. The following is the use oflinkListBasic methods and example code for retrieving and displaying the list of friendship links.

Firstly, you need to use it in the template file.{% linkList 变量名称 %}The format to obtain friendship link data. Usually, we would name the variablefriendLinksThis indicates a list of friendship links. The tag will retrieve all the friendship links configured in the background and assign them as an array object to the variable you define.

Then, you can make use offorLoop throughfriendLinksthe array to sequentially obtain the detailed information of each friendship link. Each link object includesTitle(Link name),Link(link address),Remark(link notes) andNofollow(Whether to add the Nofollow attribute, a value of 1 indicates yes, 0 indicates no) and these fields can be directly passed through the templateitem.字段名method.

This is a complete code example of displaying a friend link list in the AnQiCMS template:

{% linkList friendLinks %}
{% if friendLinks %}
<div class="friendship-links">
    <h3>友情链接</h3>
    <ul class="links-list">
    {% for item in friendLinks %}
        <li class="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 the code above, we first use{% linkList friendLinks %}Get the friend link list by tag. Then,{% if friendLinks %}Check if there is friend link data to avoid displaying an empty area when there are no links.forIn the loop, we use{{item.Link}}to output the link address,{{item.Title}}to output the link name, and through{% if item.Nofollow == 1 %} rel="nofollow"{% endif %}Intelligently add the corresponding tag to the links that are checked with the Nofollow attribute, which is crucial for SEO health. At the same time, we will alsoitem.RemarkastitleAttribute added to provide a better user experience.

In the operation of friendship links, we recommend that you pay attention to the quality of the links rather than the quantity.Choose partners highly relevant and with high weight to your website content, which can better promote website SEO.Regularly check the validity of友情链接 links, ensure that the links are not expired, and update them in a timely manner.For external links, use reasonablyrel='nofollow'The attribute is a practice for maintaining the SEO health of a website, it tells search engines not to follow these links to avoid passing unnecessary weight.

Through AnQiCMS's "Friend Links" management function andlinkListTemplate tag, you can efficiently display the friend links configured on the background in the front-end of the website.This seamless integration not only simplifies the content management process, but also brings better user experience and search engine visibility to your website.We are committed to making content operation simpler, allowing your website to stand out in the digital world.


Frequently Asked Questions (FAQ)

1. What should I do if my friend link does not display on the front-end page?

First, please log in to the AnQiCMS backend, go to the "Function Management" under the "Friend Links" module, and confirm whether you have added the friend link. If there is link data in the background, then check whether your template file has used it correctly.linkListthe tags, andforThe variable name in the loop should be consistent with the variable name defined in the label. Additionally, if the front-end does not take effect immediately after modifying the template file, please try to clear the 'Update Cache' in the AnQiCMS background or clear your browser cache.

2. How to add a friend linkrel="nofollow"?

When adding or editing a link in the "Function Management" > "Friend Links" section of the AnQiCMS backend, you will see an option (usually a checkbox) to set whether to enable the Nofollow attribute. Check this option, and when you use the template on the front-endlinkListThe system will automatically render according to the settings on the back end when these links are called<a>Add tags whenrel="nofollow"Property. You do not need to manually modify the template code to add this property, just manage it in the background.

3. Can I create friendship links in different groups and display them on different pages?

Based onlinkListThe current design of the label, it will retrieve all the links from the "friend links" module on the backend, and does not directly support filtering by "group".If you need to implement the requirement of grouping friendship links and displaying them on different pages, you can consider using the "Note" field when adding links in the background to add specific identifiers for different groups of links (for example: "Partners", "Industry Associations").Then you can in your template file,forAdd within the loopifConditional judgmentitem.Remarkfield, to selectively display or group display friendship links based on the remarks. For example,{% if item.Remark == "合作伙伴" %}.

Related articles

How to embed and display a user留言表单in a template?

As a website operator who deeply understands the operation of AnQiCMS, I fully understand the importance of providing user interaction channels on the website.The user feedback form is a key tool for collecting feedback, answering questions, and building relationships with users.In AnQiCMS, embedding and displaying a comment form through its flexible template engine is a direct and highly customizable process.This article will detail how to implement this feature in the AnQiCMS template.

2025-11-06

How to retrieve and display the website's comment list, including multi-level replies?

As a website content expert who deeply understands the operation of Anqi CMS, I am well aware of the readers' needs for interactivity and information transparency.The comment feature is an important way for users to participate in website content construction and express their opinions, and multi-level replies can effectively promote in-depth communication between users.AnQi CMS provides us with a powerful and flexible comment management mechanism, making it efficient and convenient to retrieve and display comment lists, including multi-level replies.

2025-11-06

How to get and display the list of all documents under a specific Tag tag?

As a website operator who deeply understands the operation of AnQiCMS, I fully understand the importance of efficient content management and optimization.Tags (Tag) are one of the key elements for organizing content, improving user experience, and enhancing SEO performance.By using tags, we can not only provide readers with more accurate content aggregation, but also help search engines better understand the structure of the website content.I will elaborate in detail on how to retrieve and display the list of all documents under a specific Tag label in AnQiCMS.

2025-11-06

How to display a list of tags and their details for all or specific articles on a website?

Hello!As an experienced CMS website operator, I fully understand your needs for the Tag feature in terms of content organization and optimization.Tags are an indispensable part of website content management, as they not only help users find relevant content faster, but also effectively improve the website's SEO performance.Below, I will elaborate on how to display the tag list and detailed information of all or specified articles on the AnQiCMS website.

2025-11-06

How to implement and display pagination navigation on list pages (such as article lists, search results)?

As an experienced CMS website operations personnel for an Internet security company, I know that the details of content presentation are crucial for user experience and website SEO.Page navigation is one of the fundamental and key components, which not only helps users efficiently browse a large amount of content, but also allows search engines to better crawl and index website information.Today, I will elaborate on how to elegantly display pagination navigation on the list page of AnQi CMS, such as article lists, search result pages, etc.### Overview of Pagination Mechanism in AnQi CMS Implementing pagination functionality in AnQi CMS is intuitive and efficient

2025-11-06

How does the Anqi CMS template support `if`, `elif`, `else` logical judgments?

In Anqi CMS template design, conditional logic judgment is an indispensable part for realizing dynamic content display and complex layout control.As a website operator, I am well aware that flexibly using `if`, `elif`, `else` and other logical judgment tags can allow us to present a wide variety of page content based on different data states or business requirements, thereby enhancing user experience and the interactivity of the website.The Anqi CMS template engine supports syntax similar to the Django template engine, which allows users familiar with other mainstream CMS template languages to quickly get started

2025-11-06

How to use a `for` loop to iterate over data and handle `empty` data situations?

As an experienced CMS website operations personnel, I fully understand the importance of content in attracting and retaining users.Dynamic, responsive website content display is the key to improving user experience, and effectively handling data sets, especially when the data may be empty, is a basic skill in operation work.AnQiCMS (AnQiCMS) powerful template engine provides us with flexible tools to achieve these goals, where the `for` loop tag and its `empty` block are our powerful assistants for content display.

2025-11-06

How to format a timestamp from a database into a readable date and time string?

As an experienced CMS website operation personnel of AnQi, I know that the content of the website should not only be rich, but also presented in a user-friendly manner.Time information is an important part of the content, but the timestamps (Unix timestamps) stored in the database are often just a string of numbers, which can be confusing to display directly.Therefore, formatting these timestamps into easily readable date and time strings is a key step in enhancing user experience and increasing content readability.

2025-11-06