How to use the recommended attribute `flag` in document management to control the display of content on the homepage or other special locations?

In AnQi CMS, the 'Recommended Attribute' of documentsflagis a powerful and flexible feature that allows you to finely control the presentation of website content on the home page, column pages, or other specific display areas.Understand and make good use of this attribute, which can significantly improve the content operation efficiency and user experience of your website.

What is the 'Recommended Attribute' in AnQi CMS?flag)?

In the document management module of AnQi CMS, when you add or edit a document, you will find an option named 'Recommended Attributes'.These attributes are not traditional categories or tags, but are special markers used to indicate the importance of content or specific display purposes.By selecting one or more recommended properties for a document, you can tell the system where this content should be highlighted on the website's 'special' locations.

【en】The Anqi CMS provides eight preset recommendation attributes, each identified by a single letter for easy use in templates:.

  • 【en】Top News[h][en] Typically used to mark the most important and eye-catching news or articles on a website, suitable for displaying in a large area at the top of the homepage.
  • [en] Recommended[c]Indicates high-quality content edited or recommended by the system, which can be used in various recommendation modules.
  • Slide[f][en]Content specifically used for carousel or slide show presentations, commonly used in the visual focus area of the homepage.
  • [en]Special Recommendation[a]:More specific than general recommendations, may be used to display limited-time, exclusive, or thematic content.
  • Scrolling[s]: Suitable for displaying short messages or the latest updates in bulletin boards, news tickers, or scrolling lists.
  • Bold[b]:Mainly used for style emphasis of text content, such as highlighting in title lists.
  • Image[p]Label those contents that are primarily in the form of images, such as albums, photography works, or articles with large images.
  • Jump[j]Indicates that the content may be an external link or an in-site jump, which will directly navigate to the preset URL upon clicking.

When editing documents in the background, you simply need to check the corresponding properties based on the importance of the content and the expected display location.A document can have multiple recommended attributes at the same time, which provides great flexibility for the diverse display of content.

How to apply in front-end templates?flagControl the display of content?

To actually display content with specific attributes on the website front-end,flagyou need to use the security CMS template tags to help with.archiveList.archiveListThe tag is the core tool for getting the document list, which is throughflagParameters can be used to filter out the content you need.

For example, if you want to create a carousel area on the homepage that only displays documents marked as "slideshow", you can use it like this.archiveListTags:

{% archiveList archives with type="list" flag="f" limit="5" %}
    {% for item in archives %}
    <div class="swiper-slide">
        <a href="{{item.Link}}">
            <img src="{{item.Logo}}" alt="{{item.Title}}">
            <h3>{{item.Title}}</h3>
        </a>
    </div>
    {% endfor %}
{% endarchiveList %}

In this code block:

  • archiveList archivesDefined a namedarchivesA variable to store the retrieved document list.
  • type="list"Means to get a normal list, rather than a paginated list.
  • flag="f"It is crucial, as it tells the system to only retrieve documents marked with the 'slide' attribute.
  • limit="5"It limits the display to a maximum of 5 documents.

It should be noted that, as the document emphasizes,Through front-endarchiveListWhen using the tag, each list can usually only use oneflagProperty for filtering. This means you cannot specifyarchiveListin the same tagflag="h,f"Get the headlines and slide content. If you need to display multipleflagthe content of properties, you need to use multiplearchiveListtags to call them separately.

Exceptflagparameters,archiveListIt also supportsexcludeFlagparameters to exclude those with specificflagThe documentation of the property. For example, you might have a 'Latest Articles' list, but you want it to not include any content that has already been displayed in the carousel (slide), and in this case, you can useexcludeFlag="f".

Application scenarios and advantages

recommendation attributesflagThe introduction greatly simplifies the implementation of dynamic content display.

  1. Homepage focus area: Utilizingflag="f"Provide content for the slide or carousel area,flag="h"Provide the most core information for the headline news module.
  2. Recommended list and special topicOn the article list page or sidebar, throughflag="c"orflag="a"Quickly generate modules such as 'Editor's Picks' and 'Featured Articles'.
  3. Visual content display: Useflag="p"Filter documents with images and display them in a photo gallery or a visually rich module.
  4. Announcements and notifications: Throughflag="s"Display the latest notifications in the scroll公告 at the top or side of the page.

The advantage of this mechanism lies in itsflexibility and operational efficiency.Content operation personnel do not need to touch the code, just check the corresponding recommendation attributes in the background, and you can adjust the display of the content in key positions on the website in real time.This allows the website to quickly respond to changes in operational strategies, such as promoting new products, releasing important announcements, or adjusting the focus of the homepage, without relying on technical developers to frequently modify templates.It decouples the content display logic from the content itself, greatly enhancing the convenience of content management.

Summary

The 'recommended attribute' of the Anqi CMSflagFunction provides powerful tools for website content operation, making content management more intuitive and efficient. By simply checking in the backend, and with the cooperation of the front-endarchiveListFlexible use of tags, you can easily achieve precise content delivery and personalized display, thus optimizing the user browsing experience and enhancing the overall operation effect of the website.


Common Questions and Answers (FAQ)

  1. Ask: Can a document have multiple recommended properties at the same time? Answer:Yes, a document can have multiple recommended properties checked at the same time. For example, an important news article can be both a "headline"[h]It can also be "slide"[f]. This does not mean that you canarchiveListretrieve these documents in a singleflag="h,f"to retrieve these documents. When calling from thearchiveListtag usually only based on oneflagFilter properties.

  2. Q: If I set recommended properties but they do not display on the front end, what could be the reason? Answer:This situation usually has several possible causes:

    • Template not called:It's possible that your frontend template did not usearchiveListtags, orarchiveListtags are not set correctlyflagparameters to retrieve the content you expect.
    • flagParameter error:InarchiveListUsed in the tag:flagThe parameter value does not match the letter of the attribute set in the background of the document.
    • Cache issue:The website or browser may have cached content, causing the content to not be updated in time. Try clearing the Anqi CMS backend cache and browser cache.
    • Document status:Ensure that the document itself has been published, not in draft or deleted status.
  3. Question: What is the difference between recommended attributes and document categories/tags? Answer:Recommended attributes, categories, and tags are three different content organization and display mechanisms:

    • CategoryThis is a division of content levels, which determines the归属 of the content and the URL structure, such as 'News', 'Products', 'Cases', etc.
    • tags: is a keyword description of the content, used for non-hierarchical association and search, such as "SEO optimization", "website construction", "Go language", and so on.
    • Recommended properties (flag): is a kind ofdisplayThe marker, which does not affect the classification or tag attribution of the content, but is purely used to control the display priority and form of the content in specific areas of the website (such as the homepage carousel, featured list).It focuses more on the operational level, emphasizing the 'visibility' and 'importance' of content on the user interface.