How to effectively highlight important information in content operation, so that users can find the core content at a glance, is the key to improving the website effect.AutoCMS (AutoCMS) provides a flexible recommendation attribute feature, allowing you to easily mark the importance of articles, products, or other content and display them on the website front-end as needed.This article will provide a detailed introduction on how to add these recommended attributes in the background, as well as how to categorize and display them in the frontend template.
Use the recommended attributes of AnQi CMS to make your content shine on the front page
1. Add recommended attributes to content in the background
Setting recommended attributes for articles or products is a straightforward and simple process.When you publish new content or edit existing content in the AnQiCMS backend, you can find the corresponding settings.
First, please log in to your AnQiCMS backend management interface, navigate to the "Content Management
In the content editing page, you will see a named “recommendation attributesThe area. Here are various predefined attribute types for selection, usually represented by a Chinese character and a code in parentheses, such as:
- Headline [h]English translation: : Usually used in the most prominent position on the website homepage, such as large focus images or recommended news.
- Recommend [c]: 适用于一般性的推荐内容,可以在文章列表、侧边栏等位置灵活展示。
- Slideshow [f]: 适合用于轮播图或幻灯片区域的内容,强调视觉效果。
- [en] Recommended [a]: The 'Recommended' level is higher and can be used as a secondary focus content.
- [en] Scroll [s]: Suitable for news scrolling, announcements, and other content that needs to be dynamically displayed and updated continuously.
- 加粗 [English]: 这里的“h”与头条的“h”重复,但在推荐属性中表示文本加粗,通常用于在列表中突出标题。
- [en] Image [p]: Marked as an article or product containing important images, which is convenient for display in the image aggregation area.
- [en] Jump [j]If the content itself is not directly displayed but requires clicking on an external link or another page within the site, this property can be used.
You can select one or more recommended attributes for each article or product based on the actual importance and display requirements.For example, an important article that is both a headline news and contains beautiful pictures can be checked both 'Headline [h]' and 'Picture [p]'.It should be noted that while it is possible to select multiple options, when displaying the call on the front end, it will usually be filtered for a specific attribute.
After completing the attribute selection, please make sure to save your content so that these recommended attributes can take effect.
II. Display recommended content in categories in the front-end template
In AnQiCMS, the display logic of content is mainly realized through template tags. To classify and display content with specific recommendation attributes on the front page, we need to utilizearchiveListLabel, and combine it with itsflagparameters for filtering.
archiveListLabel is a powerful tool for obtaining lists of articles, products, and other content. By using it inarchiveListsetting in the labelflagParameters, you can specify to only retrieve content with specific recommended attributes.
For example, if you want to display a "Headline News" section on the homepage, showing only those articles marked as "Headline [h]", you can use it like thisarchiveListTags:
{# 显示文章模型中被标记为“头条”的内容 #}
{% archiveList headlines with moduleId="1" flag="h" limit="5" %}
{% for item in headlines %}
<a href="{{ item.Link }}">{{ item.Title }}</a>
{# 更多内容字段,如: item.Thumb, item.Description 等 #}
{% endfor %}
{% endarchiveList %}
HeremoduleId="1"通常代表文章模型(具体ID可能因您的配置而异),flag="h"则精确筛选出带有“头条”属性的内容,limit="5"控制显示的数量。
If your requirement is to display a list of products marked as 'Recommended [c]' under a category page, you can do it like this:
{# 在当前分类下,显示产品模型中被标记为“推荐”的内容 #}
{% archiveList recommendedProducts with moduleId="2" flag="c" limit="8" %}
{% for item in recommendedProducts %}
<div class="product-item">
<img src="{{ item.Thumb }}" alt="{{ item.Title }}">
<h3><a href="{{ item.Link }}">{{ item.Title }}</a></h3>
</div>
{% endfor %}
{% endarchiveList %}
In this example,moduleId="2"May represent the product model,flag="c"Then filter out the recommended products.
Important NoticeIn the samearchiveListTag call, you can only use oneflagParameters can be used to specify a recommended attribute for filtering. This means that if you want to display "Headlines" content and "Slideshow" content on the same page separately, you need to use twoarchiveListTags, each tag is set differentlyflagParameter.
For example, display a slide area first, and then display a general recommendation area below:
{# 幻灯片区域 #}
<div class="carousel">
{% archiveList slideshowItems with moduleId="1" flag="f" limit="3" %}
{% for item in slideshowItems %}
<div class="carousel-item">
<img src="{{ item.Logo }}" alt="{{ item.Title }}">
<h4>{{ item.Title }}</h4>
</div>
{% endfor %}
{% endarchiveList %}
</div>
{# 普通推荐文章区域 #}
<div class="recommend-list">
{% archiveList generalRecommendations with moduleId="1" flag="c" limit="10" %}
{% for item in generalRecommendations %}
<li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
{% endfor %}
{% endarchiveList %}
</div>
Through this method, you can flexibly classify and display in various areas of the website according to the recommended attributes of the content, thus optimizing the user's browsing experience and highlighting the core value of the website.
Common Questions (FAQ)
问:Can I add multiple recommendation attributes at the same time in the article or product content? Answer:Yes, when editing content in the AnQiCMS backend, you can select multiple recommended attributes at the same time in the "Recommended Attributes
flagSpecify one of the properties to filter and display.问:How to display different recommended content on the homepage? For example, I want to show 'Top News' articles at the top of the page and 'Recommended' articles in the sidebar. Answer:You need to write multiple in the homepage template
archiveListtags, each tag is configured with differentflagparameters to call them separately. For example, onearchiveListTags are used forflag="h"to get the headline articles, and anotherarchiveListTags are used forflag="c"to get recommended articles.问:推荐属性对网站的SEO有影响吗? Answer:The recommended attribute itself will not directly improve your search engine ranking.But by reasonably utilizing the recommendation attributes, you can better organize the website content structure, highlight important information, increase users' stay time and interaction within the site, and these indirect factors are of positive help to SEO.A clearer content hierarchy and user experience helps search engines better understand and crawl your website.