Unlock the potential of personalized display of content model data in AnQi CMS
How to effectively and flexibly display content in today's content marketing and website operation is the key to success.We all know that the content form of each website is not the same, some need to display articles, some need to display products, and some may need to post event information, recruitment lists, and so on.If the system cannot support these diverse content structures, it will be very limited in operation.
The AnQi CMS was born to solve this pain point. It providesFlexible content modelThe function allows us to customize various content types based on actual business requirements.This means we can set fields such as 'author' and 'source' for 'articles', 'price', 'inventory', 'CPU model' and other exclusive fields for 'products', and even set 'start time' and 'location' for 'events'.How does Anqi CMS support displaying these personalized content model data on the website?
The AnQi CMS adopts a template engine syntax similar to Django, making content display intuitive and powerful.It allows us to easily call and display custom content model data through a series of carefully designed template tags, whether it is the detailed display of a single item, the list presentation of multiple items, or even complex filtering and combination, we can handle it with ease.
Flexible and diverse content detail display
When we need to display detailed information about a single item, such as a product introduction or a deep article, the core tag isarchiveDetail. This tag can help us get all the data of the current page or a document with a specified ID.
For example, if you have a product detail page, in addition to the usual title{{archive.Title}}Description,{{archive.Description}}There are also many fields that can be customized in the content model, such as "CPU model", "memory size", "graphics card type", etc. These custom fields, we can directly througharchiveDetailLabel collaborationnameCall the parameter, for example{% archiveDetail with name="CPU型号" %}Of course, if the call field you define in the background content model is English, such ascpu_modelThen you can use it directly in the template{{archive.cpu_model}}Get the corresponding value, convenient and quick.
Even better, if you want to iterate over all custom fields and dynamically display them,archiveParamsLabels come in handy. It can retrieve all custom parameters of the current document or a specified ID document, you can useforLoop them one by one, it is very suitable for displaying product parameter lists, or when the number of custom fields is uncertain. For example:
{% archiveParams params %}
{% for item in params %}
<div>
<span>{{item.Name}}:</span>
<span>{{item.Value}}</span>
</div>
{% endfor %}
{% endarchiveParams %}
For content output from rich text editors, Markdown editors (such as product details, article body), it may contain HTML tags or Markdown syntax, at this time it needs to be配合|safeor|renderA filter to ensure that the content can be correctly parsed and rendered by the browser, avoiding display as plain text code. For example:{{archiveContent|safe}}Or{{archiveContent|render|safe}}.
Display of content list with dynamic filtering
On the website, we often need to display content lists, such as popular articles on the homepage or all products under a certain category.archiveListTags are the key to realizing these list displays.
This tag allows us to retrieve content based on multiple conditions, such as throughmoduleIdspecify the content model (article model ID 1, product model ID 2), throughcategoryIdspecify the category, throughflagFilter properties (such as recommendations, slides) or throughorderSet the sorting method of parameters (such as the latest release, views, etc.). InarchiveListIn the loop, eachitemthey all represent a piece of content, you can go through{{item.Title}}/{{item.Link}}Access its built-in fields, of course, including any custom fields you define in the content model, such as{{item.CPU型号}}.
When your content model includes filterable custom fields (such as the house model has "type", "area", etc.),archiveFiltersThe tag can help you build a powerful dynamic filtering function. It will automatically generate filtering conditions and corresponding links based on the content model you set.Users can dynamically adjust the display of the list content by clicking on these filter conditions, achieving a highly personalized content exploration experience.This is especially important for website types such as real estate, recruitment, and product display.You can usearchiveFilterswitharchiveList/paginationCombine tags to create a functionally comprehensive filtering list page.
Personalized display of auxiliary content.
In addition to the document itself, AnQi CMS also provides other tags to display personalized data related to the content model:
- Category details:
categoryDetailTags can retrieve information for a specified category, including the 'Banner image', 'category content', and other fields you customize in category management, making the category page display no longer monotonous. - Single page details:
pageDetailTags are used to display single page content such as 'About Us', 'Contact Information', etc., and also support calling custom fields or images you set on the single page. - Tag details and list:
tagDetailandtagDataListTags are used to display information on the tag page and the document list under the tag, and if the tag itself has a custom description or Logo, it can also be displayed. - Global and auxiliary information:Even though
system/contact/tdkTags used to display website global settings, contact information, SEO meta information, also support calling custom parameters from the backend, ensuring that every corner of the website reflects your personalized settings.
精细化管理模板的定制
The template design of Anqi CMS is very flexible, allowing us to specify independent template files for different content models, categories, and even specific documents. For example, you can create a template for the "article" model.article/detail.htmlAs a general detail page template, but if a special article needs a unique style, a separate one can be specifiedspecial-article.htmlTemplate.
the template file adopts.htmlsuffix, stored in/templatedirectory and supportsinclude/extendsEtc auxiliary labels, which facilitate the modularization of page headers, footers, sidebars, and other common parts, greatly improving the reusability and maintenance efficiency of templates.In this way, even if the website content structure is complex and there are many personalized needs, we can still deal with it easily, maintaining the unity and professionalism of the overall website.
In summary, Anqi CMS provides a full-link personalized solution from data definition to front-end display through its powerful content model customization capabilities and flexible template tag system.Whether it is to display the exclusive attributes of a single content or to build a complex filter list, Anqi CMS can help us present technical information in a natural and smooth way, transforming it into content that is easy to understand and practical.
Frequently Asked Questions (FAQ)
How to display my custom 'Article Source' field on the article detail page?You can use it directly in the article detail template.{{archive.文章来源}}Invoke the value of this custom field, provided that the call field (English name) of the "Article Source" field in your content model is文章来源. Or, you can also use{% archiveDetail with name="文章来源" %}Tags to retrieve and display it.
2. I want the list page to be filtered according to my custom 'Product Color' field, can Anqi CMS do that?Of course you can. You need to set the 'Product Color' as a filterable field in the content model first, and then use it in the list page template.archiveFiltersTag to generate filter links. After the user clicks these links,archiveListthe tags will automatically display the corresponding product list data based on the filter parameters in the URL, realizing the effect of dynamic filtering.
3. How to display all custom fields of a document at once in a template?You can usearchiveParamsTags can be used to achieve this. For example,{% archiveParams params %}Get an array containing all custom fields, you can access aforTraverse in a loopparamsThen proceed{{item.Name}}Get the field name,{{item.Value}}Get field values to dynamically display all custom fields and their content.