Back-end settings: Add recommended properties to the document
In the AnQi CMS backend management interface, content publishing and editing is the core link of website operation.When you create a new document or edit an existing document, you will find the important option of 'Recommended Properties'.This feature aims to enable operation personnel to assign specific content classification tags to each document, thereby realizing differentiated display on the website front-end.
The specific operation process is as follows: Navigate to the 'Content Management' module, select 'Publish Document' or click on an existing document to edit.In the document editing page, you will find a section named "Recommended Properties".
- Top News[h]: This property is usually used to mark the most timely and important content on a website, which often occupies the most prominent position on the homepage to attract users' primary attention.
- [en]: Recommended [c]: 适用于那些希望在网站的各个推荐位(如侧边栏、文章末尾)向用户推广的精选内容,旨在提高内容的曝光率和用户点击率。
- Slide[f]: 专为网站首页或特定页面的轮播图、焦点图区域设计。The document marked as “幻灯” will have its title and thumbnail displayed as visual elements in this area in a loop.
- Recommended [a]: Indicates specially recommended content, which may have higher importance or attention than general recommendations. It is often used to highlight specific topics, events, or in-depth articles.
- [en]: Scroll[s]: 适用于网站的滚动新闻、公告栏或快速信息流,能够让内容以动态、紧凑的形式快速呈现给用户。
- 加粗[h]This property is intended to emphasize the document title in the text list, displaying it in bold style to highlight and make it stand out.Please note that both 'headline' and 'bold' are used in the document.
[h]As an identifier, please differentiate according to the actual behavior of the system or template definition in actual operation. - [en]: Image [p]: 标记此文档包含重要的图片资源,常用于构建图片新闻、图文混排的推荐模块,或在图片库中进行特殊展示。
- Jump [j]: Indicates that the document may contain an external link or a special internal jump. The front-end template can handle the link behavior specifically when parsing this attribute.
The operator can flexibly choose one or more recommended attributes based on the importance of the document content and the front-end display strategy.These properties are just metadata identifiers in the background. Their specific visual and interactive presentation is entirely determined by the front-end template through specific tags for parsing and rendering.
Front-end display: Using recommended attributes to implement content classification call
In the AnQi CMS, the content display of the front-end page is implemented through its powerful template tag system. The core mechanism for fully utilizing the recommended attributes set for documents by the background and implementing diverse content classification display on the front end lies in the clever use ofarchiveListTags and theirflagParameter.
archiveListThe label is a general and powerful tool used in Safe CMS to retrieve document lists.It can filter, sort, and retrieve document content based on various preset conditions.archiveListLabel configuration inflagParameters, and specify the corresponding recommended property letter identifier.
For example, if you want to build an eye-catching 'Headline News' area on the home page of your website, dedicated to displaying important documents marked as 'Headline' in the background, you can write the code like this in the front-end template:
<section class="top-headlines">
<h2>网站头条</h2>
<div class="articles-list">
{% archiveList topNews with flag="h" limit="5" %}
{% for article in topNews %}
<article>
<h3><a href="{{ article.Link }}">{{ article.Title }}</a></h3>
<p>{{ article.Description|truncatechars:100 }}</p>
<time>{{ stampToDate(article.CreatedTime, "2006-01-02") }}</time>
</article>
{% empty %}
<p>当前暂无头条新闻发布。</p>
{% endfor %}
{% endarchiveList %}
</div>
</section>
This code will filter out up to 5 documents with the attribute 'top[h]' from the entire website and display their titles, summaries, and publication times in a structured manner.
Similarly, if your website sidebar needs to display 'Recommended Reading' content to guide users to browse more selected articles, you can use `flag=“c