How to display友情链接 in front-end and add nofollow attribute according to needs?

Calendar 👁️ 68

Manage and display friendship links in Anqi CMS, which not only helps to enrich the diversity of external connections of the website, but also is a crucial link in precise operations during SEO optimization. Especially how to flexibly control according to needs.nofollowThe attribute is crucial for maintaining the health of website links and passing on weight. AnQi CMS provides an intuitive and powerful function that allows us to easily achieve these goals.


Configure friend links in the Anqi CMS backend

Firstly, all the friend links displayed on the front end cannot be separated from the detailed configuration on the back end.In the AnQi CMS management interface, you can find the "Function Management" under the "Friend Links" module.This is the place where you manage all external collaboration links.

When you add or edit a friend link, you will see the following key fields:

  • Link NameThis is the name displayed on the front end for the友情链接, such as “安企CMS official website”.
  • Link AddressThis is the complete URL pointing to the target website, such ashttps://en.anqicms.com.
  • Link noteAn internal note that helps you understand the use of the link or the partner, this note is usually not displayed on the front page.
  • Link nofollowThis option is particularly important. It is a checkbox that allows us to control whether to inform the search engine that this link should not pass the weight of our site, and also not recommend that the search engine spider track it.

Check the "nofollow" link option, which means that when rendering on the front end,<a>the tag will automatically add.rel="nofollow"Property. This has a very practical significance for controlling the SEO link weight distribution of a website, avoiding unnecessary weight loss, or indicating that a link is not a strong recommendation from this site.

Display friend links flexibly on the website front end

After managing the background data well, the next step is to display these friend links on the website page. The template system provided by Anqi CMS offerslinkListTags can help us easily retrieve the friend link data configured on the back-end.

Generally, we would place the友情链接 friendship link at the footer or on a dedicated friendship link page. Below is a basic template code example showing how to retrieve and loop through friendship links:

{% linkList friendLinks %}
{% if friendLinks %}
<div>
    <h3>友情链接:</h3>
    <ul>
    {% for item in friendLinks %}
        <li><a href="{{item.Link}}" target="_blank">{{item.Title}}</a></li>
    {% endfor %}
    </ul>
</div>
{% endif %}
{% endlinkList %}

In this code block:

  • {% linkList friendLinks %}All friendship link data will be loaded into a namedfriendLinks.
  • {% if friendLinks %}Check if there is friendship link data to avoid displaying an empty title when there are no links.
  • {% for item in friendLinks %}Iterate over each friendship link,itemThe variable represents the current loop link data.
  • {{item.Link}}and{{item.Title}}Get the address and name of the link separately.
  • target="_blank"It is a commonly used HTML attribute that opens links in a new window or tab, enhancing user experience.

Add cleverly according to needs.nofollowproperty

Now, let's solve the core issue: how to dynamically add friend links on the front end based on the backend settingsnofollowProperty. As mentioned earlier, the 'nofollow' link checkbox in the background affects each link'sNofollowProperty value. In the template, we can judge by theitem.NofollowThe value determines whether to addrel="nofollow".

item.NofollowThe rule for the value is: if the background is checkednofollowIts value is usually1if not checked, it will be other values (such as0or empty). We can take advantage of this feature to add a simple conditional judgment inside the<a>tag. Below is the modified template code that includes

a conditional judgment of thenofollowattribute:

{% linkList friendLinks %}
{% if friendLinks %}
<div>
    <h3>友情链接:</h3>
    <ul>
    {% 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 %}

through this line{% if item.Nofollow == 1 %} rel="nofollow"{% endif %}We have implemented dynamic controlnofollowproperty. If the background has checked a link'snofollowoption, then when the front-end is rendered, the<a>tag of the link will automatically includerel="nofollow"If not, it will not be included. This flexible design allows website operators to accurately manage the attributes of each friend link according to specific cooperative agreements or SEO strategies.


Through these features provided by Anqi CMS, managing the website's link exchange becomes both efficient and in line with SEO practices.Whether it is to maintain the external image of the site or to carry out fine-grained link weight control, Anqi CMS provides solid technical support.


Frequently Asked Questions (FAQ)

Q1: Why is the friend link I set in the background not displayed on the website front end?A1: First, please check if you have used the front-end template file correctly.linkListThe label and whether the loop within the label is correctly traversedfriendLinksVariable. Secondly, confirm that the friendship link you added to the backend has been enabled, and that there are no other conditions (such as custom template logic) that prevent it from being displayed.You can use the browser developer tools to check the HTML source code of the page to see if there is any link data output, thereby determining whether it is a backend configuration issue or a frontend template rendering issue.

Q2:rel="nofollow"What specific role does the attribute play? When should I use it?A2:rel="nofollow"The attribute tells the search engine not to follow this link and not to pass any "link weight" or "ranking signals" from your website to the target website. This is usually used in the following situations:

  • Paid link or advertisementTo comply with the guidelines of search engines, indicate that these links are sponsored and should not pass on weight.
  • User Generated Content (UGC)For example, links in comments or forum posts, as you cannot fully trust the quality of the content published by users.
  • Untrusted or low-quality external linksWhen you need to link to certain content but doubt its quality or authority and do not want to pass on its weight.
  • Friendship Link: Selectively add friendship links based on the quality of the partner's website and your SEO strategynofollowto better control the flow of link weight to your website.

Q3: Can I add internal links in the friend links section? Does this help with SEO?A3: In terms of technology, you can add internal links in the友情链接 section.However, doing so is usually not**practical, and it has limited help for SEO, and may even cause confusion.The main purpose of友情链接 is to link to external websites, while internal links are mainly achieved through website navigation menus, article inlinks, sidebar recommendations, and other methods.Place internal links in the "friend links" area may reduce their naturalness and the efficiency of user discovery.It is recommended that you adopt the conventional internal link strategy to optimize the site structure, rather than through the friendship link module.

Related articles

How does AnQiCMS automatically generate Sitemap and configure Robots.txt to optimize search engines' crawling and display of website content?

Search engine optimization (SEO) is the cornerstone of any website's success, and Sitemap and Robots.txt files are the key tools we use to communicate with search engines.They are like the 'instruction manual' and 'traffic rules' of a website, helping search engines efficiently and accurately crawl and display our content. 幸运的是,AnQiCMS was well thought out from the beginning of its design, built-in powerful SEO tools, making these seemingly complex operations extremely simple. Next

2025-11-08

How to customize the website navigation menu and control its display order and level relationship at different positions on the website?

The website navigation is a map for users to browse the website, not only guiding users to find the information they need, but also reflecting the structure of the website and the user experience.In AnQi CMS, customizing and managing the navigation menu of a website, including their display order and hierarchical relationships, is an operation that is flexible and efficient.In order to optimize the user experience, or to better support content marketing and SEO strategies, Anqi CMS provides powerful and intuitive tools.Next, we will explore how to customize your website navigation in Anqi CMS in detail.

2025-11-08

How to set and display the global contact information (phone, address, email, social media, etc.) of AnQiCMS?

In website operation, clear and convenient contact information is the key to building trust and promoting communication.Whether it is a phone number, address, email, or increasingly important social media channels, this information needs to be prominently and consistently displayed on your website.AnQiCMS knows this, therefore it provides a直观且集中的 way to manage the global contact information of the website, allowing your visitors to easily find you wherever and whenever.

2025-11-08

How to configure independent templates, SEO information, and content display for single pages (such as "About Us", "Contact Us")?

When operating a website, some seemingly simple single pages, such as 'About Us', 'Contact Us', or 'Terms of Service', carry the brand image, trust endorsement, and user conversion entry of the website.Independently design a visual style for these pages, optimize their search engine (SEO) information, and flexibly display content, which is crucial for enhancing user experience and the professionalism of the website.AnQiCMS provides powerful and flexible features that allow you to easily meet these needs.### Core Function: Customize Exclusive Experience for Single Page First, let's understand how to use AnQiCMS

2025-11-08

How to enable and display the captcha function correctly in the website's comment and message form?

When running a website, spam comments and malicious messages often cause headaches.They not only affect user experience, but may also consume server resources, and even reduce the professional image of the website. 幸运的是,AnQi CMS内置了验证码功能,可以帮助我们有效过滤这些不速之客,让网站环境更加清朗。Below, we will learn together how to enable and display the captcha function correctly in the website's comment and message form. ### Step 1: Enable captcha feature in the background First, we need to go to the management interface of the website background.Find 'Function Management' in the left navigation bar

2025-11-08

How to overview the key operational data display of the AnQiCMS backend homepage (such as document quantity, visit trend, inclusion situation)?

The AnQi CMS backend homepage: A smart overview of website operations In the ever-changing internet environment, an efficient and intuitive website operation backend is undoubtedly the key to controlling the overall situation for operators.AnQiCMS (AnQiCMS) fully understands this, and the design philosophy of its backend homepage is to present the core operational data of the website in a clear and easy-to-understand way in front of you, so that you can have a clear understanding of the health status and operational performance of the website at the first time.

2025-11-08

How does AnQiCMS handle the conversion of uploaded image webp format, large image compression, and thumbnail generation to optimize display performance?

In this era of pursuing speed and visual experience, the loading efficiency of website images is directly related to user retention and search engine rankings.We all hope that the images on the website can be presented in high definition and quickly displayed to the user.AnQiCMS provides us with a very practical solution in image processing, through functions such as WebP format conversion, intelligent large image compression, and diverse thumbnail generation, which help us easily optimize website images and make the website run more smoothly.### WebP Format Conversion: The Balance of Lightweight and High Definition WebP

2025-11-08

How to set and accurately display the TDK (Title, Description, Keywords) on the homepage of AnQiCMS?

The homepage, just like the digital facade of your company or brand.It is not only the first impression of your visitors, but also the key to search engines evaluating the core value of your website.The TDK - Title, Description, and Keywords on the homepage play a crucial role in Search Engine Optimization (SEO).A well-set homepage TDK can effectively improve the ranking of the website in search results, attract more target users to click, and bring considerable traffic and conversion.

2025-11-08