How to display the link list of cooperative website links with the tag `linkList`?

Calendar 👁️ 67

In website operation, friendship links (also known as cooperative website links) play an important role.They not only bring additional traffic to the website, but also help to improve search engine optimization (SEO) performance, enhance the authority and user trust of the website.In AnQi CMS, managing and displaying these links becomes very convenient, mainly due to its powerful template tag system, especiallylinkList.

Flexible display of cooperative websites:linkListThe purpose and basic principles of the tag

linkListThe tag is a powerful tool designed by Anqi CMS specifically for handling friendship links.It can dynamically retrieve all the partner website link information you have pre-configured from the background database and display it in any location on the website front end.This means that once you update the friend links in the background, the front-end page will display the latest content without manual code modification, greatly enhancing the efficiency of content management.

UselinkListLabel, you can easily build a friend link block, whether placed in the website footer, sidebar, or a special "Partners" page.It returns a list object containing all the friendship link information, and you can display it one by one like you handle a normal data list.

How to uselinkListThe tag displays friendship links on the website

To call and display friendship links in your Anqi CMS template, you need to follow a set of simple syntax rules.

First, you need to use{% linkList 变量名称 %}Declare a variable that will hold all the friend link data. For example, we can name itfriendLinks:

{% linkList friendLinks %}
    {# 在这里处理并显示友情链接列表 #}
{% endlinkList %}

friendLinksNow is an array or slice object that contains detailed information of each link. Since it is a list, you need to usefora loop to traverse and display each link:

{% linkList friendLinks %}
    {% if friendLinks %}
        <div>
            <!-- 您可以在这里添加一个标题,例如“合作伙伴”或“友情链接” -->
            <span>友情链接:</span>
            {% for item in friendLinks %}
                {# 循环中,item 代表每一个友情链接对象 #}
                <!-- 在这里构建每个链接的 HTML 结构 -->
            {% endfor %}
        </div>
    {% endif %}
{% endlinkList %}

Inforinside the loop,itemThe variable represents the current looped single friendship link object. Eachitemcontains the following key information that can be called:

  • item.Title: Link display name. For example, "Anqi CMS official website".
  • item.Link: The actual link address. For example, "https://en.anqicms.com.
  • item.Remark: Link remark information, usually not displayed directly on the front end, but may be useful under certain specific requirements.
  • item.Nofollow: A boolean value (0or1), indicates whether the link should be addedrel="nofollow"Property. This is very important for SEO strategy, it can control whether the search engine tracks the link.

Combine these fields, the following example of a complete friend link display code is as follows:

{% linkList friendLinks %}
    {% if friendLinks %}
        <div class="friend-links-section">
            <h3>我们的合作伙伴</h3>
            <ul class="link-list">
                {% for item in friendLinks %}
                    <li>
                        <a href="{{ item.Link }}"
                           {% if item.Nofollow == 1 %} rel="nofollow"{% endif %}
                           target="_blank"
                           title="{{ item.Title }} - {{ item.Remark }}">
                            {{ item.Title }}
                        </a>
                    </li>
                {% endfor %}
            </ul>
        </div>
    {% endif %}
{% endlinkList %}

In this example, we created adivcontainer and used an unordered listulOrganize friend links. Each linkaTags are dynamically boundhref(Link address),title(Hover text) and display text. It is especially important to note that we add dynamically through{% if item.Nofollow == 1 %}judgmentrel="nofollow"Property, and settarget="_blank"Ensure that the link opens in a new window to enhance user experience.

Some advanced usage and details:

  • Multi-site data call:If you are using the multi-site management feature of Anqi CMS and need to display another site's friend link in a template of a site, you can specify it throughsiteIdparameters. For example:{% linkList friendLinks with siteId="2" %}This is very practical in group website or multi-brand website management.
  • Front-end style:The above code only includes the basic HTML structure. To make the link in your website look beautiful, you need to write additional CSS styles to control its layout, font, color, etc.For example, you can set up.friend-links-sectionor.link-listAdd style rules to the class.
  • Backend Management:All of these friend link additions, edits, deletions andTitle/Link/NofollowThe settings of properties are all carried out in the "Function Management" -> "Friend Links" module of Anqi CMS background.Here the management is centralized, the front-end is dynamically called, and the flexible update of content is realized.

BylinkListThe label, Anqi CMS provides an efficient and easy-to-maintain way to manage and display partner website links.This not only helps the website's SEO performance, but also facilitates users in quickly accessing relevant resources, and is an indispensable part of building a perfect website.


Frequently Asked Questions (FAQ)

1. How to add and manage friend links in the Anqi CMS backend?

You can find the "Friend Link" module under the "Function Management" menu in the AnQi CMS backend. Click to enter, and you can easily add new friend links, fill in the name (Title), link address (Link), remarks (Remark) and whether to enable it.nofollowProperty. All changes will be reflected on the front-end immediately.linkListOn the page of the tag.

2.NofollowWhat is the role of the property? When should I use it?

NofollowIt is an HTML attribute used to tell search engines not to follow this link and not to pass 'link juice' to the target website of the link.Its main function is to control which external links your website passes the 'trustworthiness' to.You should consider using it in the following situationsnofollow:

  • Link to a website you do not fully trust.
  • Paid links, advertising links, or sponsored content to avoid being misjudged by search engines as manipulating rankings.
  • Links in user-generated content (such as comment sections, forum posts) to prevent spam links. In友情links, it is usually recommended to use non-core partners or websites you do not want to pass too much weight to.nofollow.

3. If I need to display friendship links in groups,linkListDoes it support tags?

linkListThe tag itself is designed to retrieve all friendship links without directly providing grouping parameters. However, you can agree on a grouping name (such as "Strategic Cooperation", "Industry Partner", etc.) in the "Remark" field when adding friendship links in the background, and then use it on the front endlinkListLabel all the links after using the template'sforLooping and conditional judgment (ifstatements) to group links according toitem.Remarkfields for display. For example, you can build grouping logic like this:

{% linkList friendLinks %}
    {% set strategicPartners = [] %}
    {% set industryPartners = [] %}
    {% for item in friendLinks %}
        {% if item.Remark == '战略合作' %}
            {% set strategicPartners = strategicPartners|add(item) %}
        {% elif item.Remark == '行业伙伴' %}
            {% set industryPartners = industryPartners|add(item) %}
        {% endif %}
    {% endfor %}

    {% if strategicPartners %}
        <h3>战略合作伙伴</h3>
        <ul>
            {% for item in strategicPartners %}
                <li><a href="{{ item.Link }}" target="_blank">{{ item.Title }}</a></li>
            {% endfor %}
        </ul>
    {% endif %}

    {% if industryPartners %}
        <h3>行业合作伙伴</h3>
        <ul>
            {% for item in industryPartners %}
                <li><a href="{{ item.Link }}" target="_blank">{{ item.Title }}</a></li>
            {% endfor %}
        </ul>
    {% endif %}
{% endlinkList %}

This way requires you to manually handle the grouping logic in the template, but it provides great flexibility.

Related articles

How to dynamically generate and display the user's guestbook form with the label `guestbook`?

In website operation, visitor comments and interaction are important for building trust, obtaining feedback, and promoting business development.AnQiCMS (AnQiCMS) understands this need and provides a flexible and powerful message form feature, allowing you to easily generate and display user message forms on your website.This is mainly achieved through its built-in `guestbook` template tag, which not only allows you to customize form fields but also ensures the safety and smooth submission of the form.### Understand `guestbook`

2025-11-07

How to get and display the comments made by users on the content for the comment list label `commentList`?

In today's digital world, websites are not just platforms for displaying information, but also spaces for user interaction and communication.When users can express their opinions and ask questions about the content, the vitality of the website will be greatly enhanced.Anqi CMS knows this and therefore provides a powerful and flexible comment management feature, where the 'comment list tag `commentList`' is the key bridge connecting content and user feedback. Imagine that you have published an engaging article or an innovative product, and users can't wait to share their thoughts after reading it.As a website operator

2025-11-07

How to implement the labeling display of document Tag list label `tagList`, detail label `tagDetail`, and document list label `tagDataList`?

In website operation, efficient content management and flexible content display are the key to improving user experience and search engine performance.AnQiCMS (AnQiCMS) is well-versed in this, providing powerful tag features to help us easily implement the labeling and display management of content.By skillfully utilizing `tagList`, `tagDetail`, and `tagDataList` as these core tags, we can give wings to the website content, making information organization more scientific, user search more convenient, and also lay a solid foundation for SEO optimization.Core

2025-11-07

How to implement custom attribute display and filtering for document parameter tag `archiveParams` and filter tag `archiveFilters`?

In AnQi CMS, displaying and filtering custom attributes of content is the core of implementing flexible and personalized website functions.By using the `archiveParams` and `archiveFilters` template tags, we can easily display custom content fields on the frontend and provide users with powerful functionality for filtering content based on these fields, thus greatly enhancing the website's user experience and content discoverability.### `archiveParams` Tag: Flexible Display of Custom Properties In AnQi CMS

2025-11-07

How does the pagination tag `pagination` provide navigation and display control for long content lists?

In website operation, when our content list (whether it is articles, products, or other information) accumulates to a certain amount, displaying all content on a single page not only significantly affects the page loading speed but may also make visitors feel overloaded with information, making it difficult for them to find the content they are really interested in.At this point, a reasonable pagination mechanism is particularly important. AnQiCMS provides a powerful and flexible `pagination` tag, which helps us provide clear navigation and display control for long content lists, thereby greatly optimizing user experience and website performance.Core Function

2025-11-07

How `if` logical judgment tags and `for` loop iteration tags control the conditional display and repeated display of content?

In the daily operation of Anqi CMS, we often need to decide which content should be displayed according to different business logic, as well as how to efficiently repeat the display of a large amount of similar content.At this time, the `if` logical judgment tag and the `for` loop traversal tag have become indispensable tools in template design.They allow us to flexibly control the conditional display and repetition of content, greatly enhancing the dynamicity and maintainability of the website.### The conditional display tool - `if` logical judgment tag The `if` tag is the basis for conditional content display in Anqi CMS templates

2025-11-07

How to format the timestamp label `stampToDate` to display time data in a readable format?

In a content management system, time data often exists in the form of a series of numbers, which we call a Unix timestamp.This form is very efficient for machine processing, but for us users, a string like `1678886400` is obviously not intuitive to understand the date and time it represents.AnQi CMS knows this point well, therefore it provides a very practical template tag `stampToDate`, which helps us convert these cryptic timestamps into the date and time format we are accustomed to reading.###

2025-11-07

How `include`, `extends`, and `macro` auxiliary tags optimize the template structure and affect the final display of content?

In website operation, template design is a key link in building user experience and content presentation efficiency.AnQiCMS (AnQiCMS) provides strong support for content management with its flexible template engine.Especially among the auxiliary tags such as `include`, `extends`, and `macro`, they do not directly modify the content itself, but through optimizing the template structure, they profoundly affect the final display effect and maintenance efficiency of the website content.

2025-11-07