How to use the `linkList` tag to display the list of friends' links on the website?

Calendar 👁️ 67

During the operation of our website, friendship links not only help increase the number of visits, but are also an indispensable part of SEO optimization.A healthy friendship link ecosystem, which can effectively pass on weight and enhance the authority of the website.linkList.

This article will introduce how to use in detaillinkListThe tag displays the friend link list on your AnqiCMS website.

Get to knowlinkListTag

linkListThe tag is a powerful and easy-to-use tag provided by the AnqiCMS template engine, specially used to retrieve and display the friendship links you set from the website background.By it, you can easily integrate the website's friend link into any position on the page, such as the footer, sidebar, or a dedicated friend link page.

Basic usage method

UselinkListTo get the list of friend links directly, you need to place the tag in the template file at the position where you want the friend links to appear, and配合一个forA loop to traverse each link item.

The basic calling method is as follows:

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

In this code block,friendLinksIs the variable name you customize for the friend link list. AnqiCMS will store all the friend link data obtained in this variable for subsequent use.forCyclic use.{% linkList %}and{% endlinkList %}The tag must appear in pairs, enclosing the area where you want to display the friend link content.

Tag parameters:siteId

linkListThe tag supports an optional parameter:siteId.

  • siteIdThis parameter is usually not required to be manually set. If you have created multiple sites in the AnqiCMS background management and want to call the friendship link data of other sites in the template of the current site, you can specifysiteIdTo implement. For example,siteId="2"The link of the site with ID 2 will be called. In most single-site operations, you can ignore this parameter, and the system will default to fetching the link of the current site.

Loop variable and available fields

OncelinkListLabel gets the friend link data and assigns it tofriendLinksVariable, you can then pass throughforLoop to process each link item one by one. Inside the loop, each link item is usually represented byitema variable (you can customize the name of this loop variable), anditemContains the following practical fields:

  • item.Title: The name or anchor text of the friendship link.
  • item.Link: The actual jump address of the friendship link.
  • item.Remark: Note information for the友情链接 link, usually used in backend management, may not be displayed on the front end.
  • item.Nofollow: A boolean value (or number 1/0), indicating whether the link should be addedrel="nofollow"Property.NofollowThe attribute tells the search engine not to follow this link, it is usually used for external links to avoid passing weight or handling ad links.

Actual application example

Here is a more complete example showing how to elegantly display friendship links on a webpage and add properties dynamically according toNofollowdynamic propertiesrel="nofollow":

<div class="footer-links">
    {% linkList friendLinks %}
        {% if friendLinks %}
            <h3>友情链接</h3>
            <ul class="friend-link-list">
                {% for item in friendLinks %}
                <li>
                    <a href="{{ item.Link }}"
                       {% if item.Nofollow == 1 %}rel="nofollow"{% endif %}
                       target="_blank"
                       title="{{ item.Title }}">{{ item.Title }}</a>
                </li>
                {% endfor %}
            </ul>
        {% else %}
            <p>暂无友情链接。</p>
        {% endif %}
    {% endlinkList %}
</div>

In this example:

  1. Firstly, we use{% linkList friendLinks %}tags to get all the friendship links.
  2. {% if friendLinks %}Ensure that the title and list of 'Friend Links' are rendered only when there are existing friend links, to avoid displaying an empty title.
  3. {% for item in friendLinks %}Iterate through each friend link.
  4. In<a>Tagged,href="{{ item.Link }}"Set the link address,target="_blank"Open link in a new window.
  5. {% if item.Nofollow == 1 %}rel="nofollow"{% endif %}This line is crucial, it is based on the settingsNofollowDynamically adds properties to the linkrel="nofollow".
  6. title="{{ item.Title }}"Adds a tooltip text on hover to the link{{ item.Title }}Displays the link name.
  7. If there are no friendship links, then a prompt 'No friendship links available' will be displayed.

Back-end management friendship link

Managing friend links in AnqiCMS is also very intuitive.You can find the "Friend Link Management" option under the "Function Management" menu in the background.Here, you can add new友情链接, edit the information of existing links (including link name, URL, and whether to set Nofollow), and delete links that are no longer needed.Flexible backend management ensures that you can update and maintain the website's friend links at any time.

BylinkListLabel, AnqiCMS provides website administrators with an efficient and flexible way to integrate and display friend links, which not only beautifies the website layout but also adds strength to the website's SEO performance.


Frequently Asked Questions (FAQ)

How to add and manage friend links on the AnqiCMS backend?You can find the "Function Management" menu in the left navigation bar of the AnqiCMS background management interface, click to enter, and then find the "Friend Link Management" option in it.On this page, you can add, edit, or delete the website's friend links.

What is the use of the 'Nofollow' attribute in friend links? How should I use it? rel="nofollow"The attribute is an HTML tag attribute that tells the search engine not to follow the link and not to pass any "weight" from your website to the linked website.This is typically used in the following situations: linking to untrusted content, paid advertisement links, user-generated content (such as links in comments), or external links you do not want search engines to crawl or index.NofollowProperty.

3.linkListCan the label display friendship links of a specific category or group? linkListThe tag will retrieve all the added friendship links from the background “Friendship Link Management”.Currently, it does not have built-in parameters to directly support displaying friend links by category or grouping.item.Remarkfield) to filter and display links belonging to a specific group.

Related articles

How to quickly generate a customizable website guestbook form with the `guestbook` tag?

In website operation, interacting with visitors and collecting feedback is an important link to improve user experience and obtain valuable information, and the comment form is the core tool to achieve this goal.AnQiCMS (AnQiCMS) fully understands its importance and provides the `guestbook` tag for users, allowing you to easily and flexibly build a powerful and highly customizable website guestbook form.

2025-11-08

How to display the comment list and pagination on the article detail page with the `commentList` tag?

In AnQi CMS, the comment list on the article detail page is an important component for enhancing user interaction and content vitality.To naturally and smoothly display these comments and achieve a friendly pagination experience, we need to cleverly use the `commentList` and `pagination` template tags.Next, let's take a look at how to implement the display and pagination of comments on the article detail page.

2025-11-08

How does the `tagDataList` tag display all document lists under a specific tag?

In Anqi CMS, managing and displaying content, the tag (Tag) is undoubtedly a very practical tool.It can help us organize documents more flexibly, realize multi-dimensional content aggregation, and greatly benefit the improvement of the website's SEO performance and user experience.When we need to display a list of all documents under a specific tag page, or at any location on the website, the `tagDataList` tag is an indispensable tool.###

2025-11-08

How to retrieve and display the details of a specific `tagDetail` tag?

AnQiCMS (AnQiCMS) provides a series of powerful template tags to help website operators efficiently display content.Among them, the `tagDetail` tag is a key tool for obtaining and displaying specific tag details.Whether it is to build a beautiful tag detail page or to refer to related data of tags on other pages, `tagDetail` can provide a flexible and intuitive solution.

2025-11-08

How to use the `pagination` tag to generate a beautiful pagination navigation for articles or product lists?

In website operation, as the content volume continues to grow, whether it is articles, products, or other lists, how to efficiently organize and display these contents while ensuring a smooth user browsing experience and a friendly search engine is a problem that needs to be carefully considered.Page navigation is the key tool to solve this problem.AnQiCMS provides a powerful and flexible `pagination` tag that allows you to easily create beautiful and functional pagination navigation for various lists.

2025-11-08

How to flexibly control the conditional display and loop iteration of logic tags such as `if` and `for` in the template?

In the world of AnQi CMS templates, we often need to display content based on different conditions or repeat a series of data, at this point, the `if` and `for` logical tags become particularly important.They are the foundation for building dynamic content and implementing flexible layouts in templates, allowing us to precisely control the presentation of every piece of information on the web page.

2025-11-08

How to use the `stampToDate` tag to format a database timestamp into a readable date?

In website operation, we often encounter such situations: the time information stored in the database, such as the publication time of articles, the creation time of goods, etc., is often in the form of a series of numbers (timestamps).This string of numbers is clear to machines, but it has poor readability for us users.Imagine, if next to an article it displays '1678886400' instead of '2023/03/15', wouldn't that be a big discount in experience?AnQi CMS knows this and has provided a very practical template tag——`stampToDate`

2025-11-08

How `include`, `extends`, and `macro` tags enhance the reusability and maintainability of template code?

## Improving AnQi CMS template efficiency and maintainability: the clever use of `include`, `extends`, and `macro` In the daily content operation of AnQi CMS, we often need to create and manage a large number of pages.How to ensure that these pages maintain consistency while also being developed and maintained efficiently is a challenge that every operator has to face.

2025-11-08