How to dynamically display a list of friend links in the footer or sidebar of a website?

Calendar 👁️ 66

In website operation, friendship links are one of the important ways to enhance website authority, obtain external traffic, and improve user experience.A system that is convenient to manage and can dynamically display friend links will undoubtedly greatly improve operational efficiency.The AnQi CMS is an efficient content management system that provides flexible friend link management features, allowing you to easily display these valuable external resources in the footer or sidebar of your website.

Friend link management in AnQi CMS

First, the management operation of the friendship link is very intuitive. You just need to log in to the AnQi CMS backend management interface, and you can find the "Friendship Link" item in the "Function Management" menu on the left.Here, you can conveniently add, edit, or delete links.Each link can be set with its name, specific URL address, some remarks, and whether it is enablednofollowProperties. These backend settings will directly affect the display effect of the front-end page and the SEO strategy.

Dynamic display: clever use.linkListTemplate Tag

The Anqi CMS template system is designed to be very flexible, drawing on the syntax of the Django template engine, allowing you to dynamically call website data through simple tags. To display the list of friend links you have set up in the background on the website front end, we need to use a special template tag -linkList.

linkListThe tag is used to retrieve all the friendship link data you maintain in the background and provide it to the template in a traversable list format. Its basic usage is{% linkList 变量名 %}For example, you can define it as{% linkList friendLinks %}In this way, all the friend link data will be stored infriendLinksthis variable for your subsequent operations.

due tofriendLinksis an array object containing multiple link information, you need to useforto iterate through each specific content of the friendship link one by one. In the loop, each link item is usually nameditemIt includes various properties of the link, such as:

  • item.Title: The display name of the link.
  • item.Link: The URL address of the link.
  • item.Remark: The remark information of the link (if filled in on the back-end).
  • item.NofollowA boolean value indicating whether the link has been setnofollowProperty.

Next, you can render this information into an HTML structure, generating clickable links. Considering SEO and user experience, we usually addtarget="_blank"Property, open the link in a new window, and add conditionally based on backend settings.rel="nofollow"Property.

Here is an example of a template code to display a list of friendship links:

{% linkList friendLinks %}
{% if friendLinks %} {# 建议先判断是否有友情链接,避免页面出现空白区域 #}
<div class="friend-links-section">
    <h3>友情链接</h3> {# 您可以自定义标题,例如“合作伙伴”、“推荐站点”等 #}
    <ul class="friend-links-list">
    {% 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 %}

In this code block:

  • {% linkList friendLinks %}Get friend link data.
  • {% if friendLinks %}the judgment.friendLinksWhether the variable has content, ensure that the entire area is displayed only when there is a link.
  • {% for item in friendLinks %}Iterate through each friend link.
  • {{item.Link}}and{{item.Title}}Output the address and name of the link separately.
  • {% if item.Nofollow == 1 %} rel="nofollow"{% endif %}It will dynamically add links based on the background settings.rel="nofollow"Property, which helps control the weight transfer of the website.
  • target="_blank"Ensure that the link opens in a new tab after clicking, enhancing the user's browsing experience.

Place the友情链接 friendship link at a specific position on the website.

In a website, the footer or sidebar is a common place to display links.The template design of AnQi CMS usually divides these common areas into independent template files.You may need to refer to the topic you are currently dealing withtemplateUnder the directory, find similarpartial/footer.htmlorpartial/sidebar.htmlsuch a file.

You just need to copy and paste the above provided code snippet into the corresponding template file where you want to display the friendship link.After saving and refreshing the website page, you will see the dynamic display of the friend link list set in the background on the website.This modular design allows you to manage links centrally and flexibly control their display at various locations on the website.

If you are using the multi-site management feature of Anqi CMS and want to call the friend link data of other sites on a specific site,linkListLabels also providedsiteIdTo achieve this goal, parameters can be used. For example:{% linkList friendLinks with siteId="1" %}The link list of the site with ID 1 will be obtained.

In this way, Anqi CMS not only simplifies the maintenance of friendship links, but also provides powerful template tag support, making content display more flexible and diverse.


Frequently Asked Questions (FAQ)

  1. Why is my website footer/sidebar not displaying the friend links?
    • Please check if the link has been added in the 'Function Management' -> 'Friend Links' section of the AnQi CMS backend. If not added, the frontend will not display naturally.
    • Secondly, confirm whether you have alreadylinkListcorrectly pasted the tag code into the corresponding position of the website template (for examplepartial/footer.htmlorpartial/sidebar.html). Please check whether the path of the template file and the code are complete and correct.
    • If you are using the multisite feature, please checklinkListwhether the tag is specified correctlysiteIdthe parameters to call the target site's affiliate link.
  2. in the affiliate link.rel="nofollow"What is the role of the attribute?
    • rel="nofollow"It is an HTML attribute that tells the search engine not to follow this link and not to pass the page authority to the target page of the link.In the context of friend links, it is often used to avoid negative impacts on SEO due to linking to low-quality websites, or when the nature of the link is advertising or user-generated content, to comply with the search engine's **practical guidelines.
  3. Can I display different groups of friend links in different areas of the website?
    • linkListThe tag itself does not provide a direct "grouping" parameter in the document. However, you can use the "note" field to classify tags when adding friend links in the background, and display them through templates on the frontend.ifstatement and string judgment (for example{% if item.Remark == "合作伙伴" %}to filter and display.
    • Another method is to take advantage of the multi-site feature of Anqi CMS. If your friend links are indeed for different themes or purposes, consider managing different sets of friend links under different sites and throughsiteIdThe parameter calls the exclusive friends link list of the specific site.

Related articles

Does AnQi CMS support the rendering of content in Markdown format and can it correctly display mathematical formulas and flowcharts?

For Anqi CMS users, whether they can use Markdown format for content creation and smoothly display complex mathematical formulas and visualized flowcharts is a key consideration for enhancing content expression.It is pleasing to see that Anqi CMS indeed provides good support for these advanced content formats, and through a set of flexible configuration mechanisms, allows content creators to easily achieve this goal. ### Enable Markdown Editor First, content creators need to make simple settings in the Anqi CMS backend.Enter the "Global Settings" menu

2025-11-08

How to set up independent custom templates for specific articles, categories, or single pages to achieve personalized content display?

In content operations, creating unique visual and functional experiences for different parts of the website is crucial for enhancing brand image, optimizing user experience, and accurately conveying information.AnQiCMS (AnQiCMS) fully understands this, providing flexible template customization capabilities, allowing us to set personalized display templates for specific articles, categories, even independent single pages, thus achieving differentiated content presentation.The core of this feature lies in its ability to allow us to摆脱网站全局模板的限制, to design and apply specific layouts or styles targetedly, in order to better match content themes or operational objectives. For example

2025-11-08

How to dynamically retrieve and display the title and link of the previous and next articles on the article detail page?

When browsing articles on a website, navigation links such as 'Previous' and 'Next' often appear at the bottom.This seemingly simple detail actually has a significant impact on user experience and the consistency of website content.It not only guides visitors to continue exploring more content, helps to increase the average page visit duration, but also optimizes the internal link structure of the website.For friends using AnQiCMS, implementing this feature is much simpler than imagined, as it comes with powerful template tags that make it easy to dynamically retrieve and display this navigation information.###

2025-11-08

How to use the `categoryList` tag to build and display a multi-level, nested category navigation menu?

In website operation, a clear and easy-to-navigate menu structure is a core factor in improving user experience and search engine friendliness.For websites with a large amount of content or a variety of product lines, it is particularly important to build a multi-level, nested category navigation menu.AnQiCMS provides powerful template tag functions, where the `categoryList` tag is the key to achieving this goal.This article will delve into how to use the `categoryList` tag to flexibly build and display your multi-level category navigation menu

2025-11-08

How to automatically generate and display breadcrumb navigation that conforms to SEO standards on a webpage?

In website operation, providing clear navigation paths for visitors while optimizing the crawling efficiency of search engines is a key link to improve user experience and website SEO performance.A breadcrumb navigation is a feature that can intuitively display the hierarchical position of the user on the current page and provide a convenient return path.For websites built using AnQiCMS, we can conveniently utilize its built-in features to automatically generate and display breadcrumb navigation that complies with SEO standards.###

2025-11-08

How to configure the pagination display of the article list and allow custom pagination links and styles?

In website operation, as the content volume grows, how to effectively organize and present these contents so that users can easily browse them is the key to improving user experience and website performance.The pagination display of the article list is an important means to achieve this goal.AnQiCMS provides a powerful and flexible template tag feature, allowing us to easily configure the pagination display of article lists and customize the link structure and visual style of pagination according to actual needs.### Configure the article list to enable pagination Enable pagination for the article list

2025-11-08

How to clearly display the user's input search keywords and related documents on the search results page?

In Anqi CMS, create a highly efficient and user-friendly search results page that can not only help visitors quickly find the information they need, but can also significantly improve the overall professionalism and conversion rate of the website.This article will delve into how to clearly display the search keywords and related documents entered by users under the powerful functions of AnQi CMS.Build a dedicated search page template: Clearly show user intent The template system of Anqi CMS is known for its high flexibility, allowing you to customize each page according to your business needs.The search results page usually corresponds to the current template directory under

2025-11-08

How can AnQi CMS display image watermarks or anti-crawling interference codes on the front end to protect original content?

In the current information explosion of the Internet environment, the value of original content is increasingly prominent.However, content plagiarism and malicious scraping have also become a major headache for many website operators, not only damaging the creators' labor results, but also possibly affecting the website's search engine rankings and brand reputation.Faced with this challenge, AnQiCMS (AnQiCMS) fully understands the importance of content protection, and is built-in with front-end image watermarking and anti-crawling interference code functions, aiming to provide a solid defense line for your original content.### Understand the necessity of content protection Before discussing specific features

2025-11-08