How to display a list of friendship links on the front page of the website?

Calendar 👁️ 80

In website operation, friend links have always been an important means to enhance website authority, increase external traffic, and strengthen user trust.If you are using AnQiCMS to manage your website and want to display a list of friend links on the front page, you will find that this process is surprisingly simple and efficient.Anqi CMS with its simple design and powerful features makes content management easy, and the display of friend links is no exception.

Next, let's see how to implement the display of friend links in Anqi CMS together.

Step 1: Manage friend links in the background

Firstly, we need to add and manage friend links in the Anqi CMS backend. This is a very intuitive process:

Log in to your AnQi CMS backend, and you will find the "Function Management" menu in the left navigation bar.Click to enter and you can see various auxiliary function options, including "Friendship Link Management".

Enter the "Friend Links Management" page, where you can easily add new friend links. For each link, you need to fill in the following information:

  • Link NameThis is the text displayed for the friend link on the front-end page.
  • Link AddressThis is the actual URL that the friend link points to.
  • Nofollow attributeThis is a very practical SEO feature.When you do not want to pass the weight of your website to a link in the friendship link, or link to some external sites, you can choose to enable the 'Nofollow' attribute.This tells the search engine not to track this link, which helps maintain the SEO health of your website.

You can add any number of friendship links as needed, and you can edit or delete them at any time.

Step 2: Call the friendship link list in the front-end template.

After completing the friendship link settings on the backend, the next step is to display them on the website's frontend page.AnQi CMS provides special template tags to retrieve this data, allowing you to avoid writing complex database query code.

Generally, friend links are displayed in the footer, sidebar, or an independent "Friend Links" page of a website. The template files of Ananqi CMS are located/templateUnder the directory, you can choose to modifybash.html(usually contains the common header and footer code of the website) or inpartial/For example, a code snippet file in the directoryfooter.htmlTo display uniformly. Of course, if you only want to display it on a specific page, just add it to the template file of that page.

The tag used by AnQi CMS to call the friend link islinkList. It will fetch all the friendship link data configured in the background and encapsulate it in a variable available for iteration.

The following is the basic code structure you can use in the template:

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

Let's take a detailed look at this code:

  • {% linkList friendLinks %}This is a core tag, it retrieves all the friendship link data from the background and assigns it tofriendLinksthis variable.
  • {% if friendLinks %}and{% endif %}This is a conditional judgment, which is very important. It ensures that only whenfriendLinksthere is indeed data in the variable (i.e., the back-end has set up friend links), will this entire section be rendereddivBlock. This can prevent an empty title or list from appearing on the page when there are no friend links, keeping the page tidy.
  • {% for item in friendLinks %}and{% endfor %}: This is a loop structure, it will traversefriendLinksEach item in the collection. In each iteration, the data of the current link will be assigned toitemVariable.
  • {{item.Link}}: Used to output the URL address of the current link.
  • {{item.Title}}Used to output the display name of the current friendship link.
  • {% if item.Nofollow == 1 %} rel="nofollow"{% endif %}This is a clever conditional judgment that checks the background settings for the current link.NofollowProperty. If this property is set to 1 (indicating enabled), it will automatically be<a>tagsrel="nofollow"Property, perfectly supporting your SEO strategy.
  • target="_blank"This is a standard HTML attribute that indicates that the target website will open in a new browser tab after clicking the link, enhancing the user experience.

Add this code to the template file where you want to display the friend links, save and refresh your website page, and you will see the list of friend links configured in the background.

Step 3: Beautify the display style of the link

After the code deployment is complete, you may still need to make some style adjustments to the friend link list to better integrate it into the overall design of the website.You can control the layout, font, color, spacing, and other elements of the list with CSS.

In the static resource directory of your website (usually/public/static/css/), you can target the style file defined in the above code.classfor example.friendship-links-section/.section-title/.friendship-links-list/.link-itemand.link-anchorAdd CSS rules. For example, you can make links horizontal or set hover animation effects to make the page look more professional and beautiful.

The Anqi CMS template engine supports Django template engine syntax, giving you great flexibility in customizing these personalized front-end features. You can create a unique style of friendship link display area according to your design needs.

In general, Anqi CMS provides a very smooth solution for friend links from backend management to frontend display.It is not only simple to operate but also well considered in SEO optimization, helping your website better connect with the outside world.


Frequently Asked Questions (FAQ)

Question 1: Can I display the list of friendship links at any position on the website?Answer: Yes, you can place the template call code for the friendship link anywhere in the front-end template file where you want to display it. Whether it's the footer, sidebar, a standalone page, or a specific location within the article content, just paste the correspondinglinkListLabel code, the friend link list can be rendered correctly.

Question 2: What will the front-end page display if I do not set any friend links in the background?Answer: If you have not set any friendship links in your background or all links have been deleted, the code snippet provided in our article will be affected by{% if friendLinks %}This condition judgment will not render the entire friend linkdivsection. This means that there will be no empty "friend link" title on the page, keeping the page clean and tidy.

Question 3: Can the order of the friend links be adjusted?Answer: In the Anqi CMS backend "Friend Link Management" function, you can adjust the display order of the links by editing them.Generally, the system arranges items according to the order in which they were added or most recently edited. You can find options to adjust the order in the background or change the position in the list by editing the link.

Related articles

How to customize the display of Banner Carousel images on the website homepage?

In website operation, the homepage Banner carousel image is an important component to attract visitors' attention and convey core information.AnQiCMS (AnQiCMS) understands this need and provides a flexible and convenient way for you to easily customize and display these key visual elements on the homepage of your website. ### Prepare: Manage Your Banner Image in the Background First, we need to make sure that the images used for the carousel have been uploaded and properly managed.The AnQi CMS usually provides a special "Banner Management" area in the background

2025-11-09

How can you format a timestamp to display the publication date in a friendly date and time format?

In website operation, the content publication date is not just a time mark, it is also an important basis for visitors to obtain information timeliness.A clear and readable date format that can significantly improve user experience and make your website content appear more professional and considerate.However, in a powerful content management system like AnQiCMS, the publication date is usually stored in the database in the form of a "timestamp", which is usually a string of numbers that is difficult to understand directly.For example, you might see a number like `1609470335`

2025-11-09

How to control the display of different styles for odd and even rows in a table or list loop?

In web design and content presentation, in order to enhance the user reading experience and make the information presentation clearer, we often need to apply different styles to the odd and even rows in tables or lists.This visual distinction not only breaks the monotony of the content, but also significantly improves the readability of the data.In AnQiCMS, with its flexible and powerful template engine, achieving this effect is quite direct and convenient.

2025-11-09

How can you determine if a variable exists in a template and dynamically display content based on the result?

Build an energetic website on AnQiCMS, content management is not just about publishing information, but also about how to intelligently present these information.Imagine if your website could flexibly adjust the display style based on the actual data, for example, showing an image if there is one, and displaying alternative text if there isn't;If there is relevant content, recommend it; if not, kindly prompt The key to realizing this intelligent dynamic display lies in how to determine whether a variable exists in the template

2025-11-09

How to use breadcrumb navigation tags to display the current page path at the top of the page?

In website operation, a clear navigation path is crucial for user experience and search engine optimization.When a user is browsing deep pages on a website, a straightforward 'You are here' prompt can help them quickly locate and easily return to the parent directory.This is a kind of auxiliary navigation method, which we call breadcrumb navigation.AnQiCMS (AnQiCMS) is built-in with powerful breadcrumb navigation tags, allowing developers and content operators to easily display the current location path at the top of the page.What is breadcrumb navigation and why is it important?

2025-11-09

How to display the content, title, and image of a single page in a custom page?

In website operation, we often need to create unique display methods for specific content, such as designing a unique landing page for product features, service introductions, or company profiles.AnQiCMS (AnQiCMS) with its flexible content model and highly customizable features, makes everything very simple.Today, let's talk about how to easily display the content, title, and images of a custom page, making your website content more personalized.

2025-11-09

How to define a temporary variable in a template and use it to display content?

In Anqi CMS, when managing website content, we often find that using temporary variables flexibly in templates can make the code more concise, efficient, easy to understand, and maintainable.The Anqi CMS template system has borrowed the syntax of the Django template engine, which provides a straightforward way to define and use these temporary variables. ### Temporary variables make the template more concise and efficient Why do we need to define temporary variables in the template?

2025-11-09

How to truncate long text content in a template and add an ellipsis for display?

In website content operation, we often encounter scenarios where it is necessary to display long text, such as article abstracts, product descriptions, or user comments.If the complete content is displayed directly, it may cause the page to be long and disorganized, affecting the reading experience of the user.At this time, the long text is intelligently truncated and an ellipsis (...) is added at the end, making it an elegant and practical solution.AnQi CMS as a powerful content management system, its flexible template engine provides a variety of convenient ways to meet this need.### Efficient Core Tool for Extracting Long Text Content

2025-11-09