How to control the special display of content on the homepage or other blocks (such as headlines, sliders)?

Calendar 👁️ 68

In website operation, we often need to make certain important content stand out on the homepage or in specific areas to attract visitors' attention, such as the latest headline news, exquisite product slides, or urgent notification announcements.AnQiCMS provides a very intuitive and efficient mechanism to handle this requirement, namely 'recommended attributes'.

What is the recommended attribute?

In AnQiCMS, recommended properties are like 'tags' for content, you can mark articles, products, events, and other content with specific tags to tell the system that they should be treated differently, and displayed in special ways at different positions on the website.These properties are preset to meet the common needs of website content display.

AnQiCMS built-in a variety of recommendation attributes, each attribute corresponds to a short letter code, convenient for calling in templates:

  • Headline [h]This is typically used in the most important and most prominent position on a website, such as the large news on the homepage.
  • Recommend [c]This indicates that the content has high recommendation value and is suitable for display in the sidebar or related content area.
  • Slide [f]: Often used for content that needs to be displayed in a carousel format, such as the large image scroll at the top of the homepage.
  • Special recommendation [a]: Specifically refers to content that is particularly recommended, which may be more important than regular recommendations.
  • Scroll [s]: Suitable for short messages or notifications that need to be displayed in a marquee or scrolling list.
  • Bold [h]: May be used in some designs to display titles in bold in lists to highlight them.
  • Image [p]Ensure that the content will always display a thumbnail in the list, even if there is no image, the system will try to use the default image.
  • Jump [j]Set the content link as an external link, which will jump to another website or page when clicked.

How to set recommended attributes for content in the background?

It is very simple to set these recommended properties. When you enter the AnQiCMS backend, in the interface for publishing or editing any document (such as articles, products), you will see a section named "Recommended Properties".This area is usually presented in the form of a checkbox, listing all available properties and their corresponding functions.

You can select one or more properties based on the characteristics and display priority of the content.For example, a particularly important news article, you might check 'Top News [h]';If it needs to appear in the homepage carousel as well, you can also check the "Slide[f]".If you only want to force an article to display with an image in the list, even if there is no image in the content, you can check the 'Image[p]'.These properties can be freely combined, of course, you can also choose not to set any properties, so that the content is displayed in the normal way.

How to call and display these special contents in the front-end template?

It's not enough to set the properties, we also need to tell the website template how to retrieve and display the content based on these properties. The core tool in AnQiCMS templates isarchiveListThe label is responsible for retrieving the content list from the database. To use recommendation attributes to filter content, we need to inarchiveListUsed in tagsflagParameter.

For example, if you want to display all articles marked as "top news[h]" in a "top news" area on the homepage, you can write the code in the template like this:

{# 首页头条区展示 #}
<div class="headlines-section">
    <h2>头条新闻</h2>
    {% archiveList topHeadlines with type="list" flag="h" limit="5" %}
    {% for item in topHeadlines %}
    <div class="headline-item">
        <a href="{{ item.Link }}">
            <h3>{{ item.Title }}</h3>
            <p>{{ item.Description|truncatechars:100 }}</p>
        </a>
    </div>
    {% endfor %}
    {% endarchiveList %}
</div>

Hereflag="h"It is to inform the system to only retrieve the content that is marked with the 'headline' attribute, andlimit="5"restricted to displaying the latest 5 entries.

For example, if your website homepage has a picture slideshow area that needs to display articles marked as "slide[f]":

{# 幻灯片/轮播图区展示 #}
<div class="carousel-section">
    <div id="homepage-carousel" class="carousel slide" data-ride="carousel">
        <div class="carousel-inner">
            {% archiveList slideshowItems with type="list" flag="f" limit="3" %}
            {% for item in slideshowItems %}
            <div class="carousel-item {% if forloop.Counter == 1 %}active{% endif %}">
                <img src="{{ item.Logo }}" alt="{{ item.Title }}">
                <div class="carousel-caption">
                    <h3><a href="{{ item.Link }}">{{ item.Title }}</a></h3>
                    <p>{{ item.Description|truncatechars:150 }}</p>
                </div>
            </div>
            {% endfor %}
            {% endarchiveList %}
        </div>
        {# 这里可以添加轮播控制按钮和指示器 #}
    </div>
</div>

It should be noted that,flagThe parameter can only be specified once. If you need to retrieve content with multiple attributes at the same time, you need to call it multiple timesarchiveListTags, or combine them through other logic on the front end.

About the supplement to pure picture slides:

If you just need a pure picture carousel display and not associated with specific article content, AnQiCMS also providesbannerListLabel. You can upload and manage image groups in the background under settings such as 'Website Navigation' or 'Page Resources', and then use them in templates.bannerListLabel and specify the group name to call, for example:

{# 纯图片Banner幻灯片展示,假设后台设置了“首页幻灯”分组 #}
<div class="banner-carousel">
    {% bannerList banners with type="首页幻灯" %}
    {% for item in banners %}
    <a href="{{ item.Link }}" target="_blank">
        <img src="{{ item.Logo }}" alt="{{ item.Alt }}">
    </a>
    {% endfor %}
    {% endbannerList %}
</div>

These two methods have their respective focuses,archiveListCombineflagIt is suitable for displaying recommendations with article content, whereasbannerListIt is more suitable for pure visual element promotion.

Apply flexibly with **practice

These recommendations

Related articles

How to set the document title, introduction, thumbnail, and optimize its display effect on the list and detail pages?

AnQiCMS provides a comprehensive mechanism to help us manage the title, summary, and thumbnail of website content in detail.These elements are not only the foundation for content display, but also the key to improving user experience and SEO optimization (SEO).Set and optimize their display on list and detail pages to make our website content more attractive and easier for search engines to crawl and understand.### Basic backend settings: Make content information clear and accurate In the AnQiCMS backend, whether it is to publish articles, products, or create single pages

2025-11-09

How does the adaptive, code adaptation, and PC + mobile independent site mode affect the display compatibility of front-end content?

In website operation, ensuring that your content displays perfectly on various devices is the key to improving user experience and SEO effectiveness.AnQiCMS (AnQiCMS) provides three flexible mode options for displaying front-end content compatibility: adaptive, code adaptation, and PC + mobile independent site mode.Understanding how these patterns work and their impact on the display of your front-end content can help you better plan and manage your website.### One, Adaptive Mode: Single Template, Smooth Experience on Multiple Devices Adaptive mode, as the name implies

2025-11-09

How to dynamically display content through Django template engine syntax in AnQiCMS?

How to use Django template engine to achieve dynamic content presentation in AnQiCMS?AnQiCMS as an efficient and customizable content management system, one of its core advantages lies in its powerful content display capabilities.This is largely due to the system's support for Django template engine syntax.This means that content operators and website developers can flexibly obtain, process, and display all kinds of data on the front-end page without writing complex backend code.**Core Mechanism: Understanding Django

2025-11-09

How to precisely control the display style of articles, products, categories, and other content in custom templates?

On the day when digital content is becoming increasingly important, the way websites present their content directly affects user experience and brand image.AnQiCMS (AnQiCMS) knows this, and therefore integrated highly flexible template customization capabilities into the system design from the beginning, allowing users to accurately control the display styles of various types of content such as articles, products, categories, and even single pages.This is not just a simple theme change, but goes deep into every content block, allowing every detail of the website to be presented according to your imagination.Understanding AnQiCMS

2025-11-09

How to optimize page titles and descriptions for search engine results using advanced SEO tools (TDK, standard links)?

In website operation, it is crucial to make your content stand out on search engine result pages (SERP) and attract targeted users to click.This not only concerns website traffic, but also directly affects brand exposure and business conversion.AnQiCMS (AnQiCMS) understands this need and provides you with a series of advanced SEO tools to help you refine the optimization of page titles, descriptions (TDK), and standard links, thereby enhancing the search engine visibility of your website.### The Foundation for Improving Search Engine Visibility: The Refinement of TDK Settings TDK

2025-11-09

How to automatically handle or manually set image lazy loading for document content in AnQiCMS to improve display performance?

In today's fast-paced online environment, website loading speed is crucial for user experience and search engine rankings.Images are often an important part of web page content and can also be a key factor affecting page loading performance.This problem was solved by the emergence of lazy loading technology for images.AnQiCMS as an efficient content management system, provides us with flexible image optimization and lazy loading implementation solutions.Understanding Image Lazy Loading and Its Importance

2025-11-09

How to optimize front-end loading and display by converting and automatically compressing images within the site to Webp format?

Optimize the website front-end loading and display, images are one of the key links.For us who pursue efficiency and a good user experience, it is crucial to properly handle the images on the site.The AnQiCMS (AnQiCMS) provides very practical functions in this aspect, through WebP format conversion and automatic compression, we can significantly improve the loading speed and image display effect of the website.We all know that large image files are a common cause of slow website loading.This will not only affect the user experience and increase the bounce rate, but also have a negative impact on search engine optimization (SEO)

2025-11-09

How different thumbnail processing methods (aspect ratio scaling, padding, cropping) affect the display effect of images on the front-end?

In website operation, images play a vital role, especially in places like list pages and detail pages where thumbnails are displayed. They not only affect the beauty of the page but also directly relate to the click-through rate and reading experience of users.AnQiCMS (AnQiCMS) offers various flexible thumbnail processing methods to help users meet the needs of image display in different scenarios.Understanding how these methods - scaling, padding, and cropping - affect the final presentation of images on the front end is particularly important for optimizing the visual experience of a website.Why is thumbnail processing so crucial

2025-11-09