How to flexibly display content based on different content models?

Calendar 👁️ 71

AnQiCMS is a system designed for efficient content management, one of its core advantages lies in its flexible content model, which allows the display of website content to be highly customized according to business needs and user experience.

To make full use of the AnQiCMS content model for flexible display, we can understand and operate from the following aspects.

first, Understand the essence and function of the content model.It is fundamental. In AnQiCMS, the content model is not just a term for predefined categories like "articles" or "products", it is more like a custom content skeleton.The system is built-in with 'Article Model' and 'Product Model' as general examples, but users can completely create new models according to their own business logic, such as 'Case Display', 'Team Members', 'News Release', 'Activity Registration', and so on.Each content model can define a set of exclusive fields, which can be single-line text, numbers, multi-line text, as well as single-choice, multi-choice, drop-down selections, and more types, and can be set to be required or have default values.This flexibility ensures that no matter how complex and diverse the content is, it can be stored and managed in the most structured way possible.For example, defining fields such as 'product price' and 'inventory quantity' for the 'product model', and defining fields such as 'publishing organization' and 'author' for the 'news release model', can make content management more refined.

secondly,The template system is a brush for displaying content models。AnQiCMS uses a syntax similar to the Django template engine, allowing us to display structured data of content models on the front-end. Template files are usually named with.htmlwith suffix, and organized in/templatedirectory. The system has a smart template matching mechanism, such as for the content of "product model", the system will prioritize searchingproduct/detail.htmlas a detail page template, searchingproduct/list.htmlAs a list page template.

But the real flexibility lies in.Customized template customization.Top. AnQiCMS supports specifying exclusive templates for specific content, categories, and even single pages.For example, if you want a product (ID 10) to have a unique display page, you can create a namedproduct/10.htmlThe template file. Similarly, if all products under a certain category (ID 10) require a special list layout, you can createproduct/list-10.html. When editing articles, categories, or single pages in the background, you can also manually specify a custom template file path in the "Document Template" or "Category Template" field (for exampledownload.htmlLet the content be presented with a completely different visual presentation. This multi-level template overlay mechanism allows developers and operators to tailor the display scheme for every corner of the website.In addition, AnQiCMS also supports creatingmobile/The directory to store mobile template, to achieve differentiated display of PC and mobile content, or to manage them uniformly through adaptive and code adaptation mode.

Moreover,Rich template tags are the conductors of content displayAnQiCMS provides a variety of built-in tags for extracting and displaying data from the content model.

  • archiveListandarchiveDetailTags are the core for listing and displaying documents (including articles, products, and custom model content). By these tags, we can flexibly according tomoduleId(Content Model ID),categoryId(Category ID),flag(Recommended attribute),order(Sorting method) as well aslimit(Display quantity) and other parameters, to accurately control the invocation of content. For example, on a product list page, we can usearchiveList archives with moduleId="2" categoryId="1" order="views desc" type="page" limit="10"to display the most viewed product under a certain category, and combinepaginationTagging implements pagination.
  • For the defined content modelCustom fieldwe canarchiveDetail with name="自定义字段名"Directly obtain its value, or also usearchiveParamsLabel to iterate over all custom fields, displaying in key-value pairs dynamically. This is particularly useful for building product parameter lists, event details, and other scenarios.
  • categoryListandcategoryDetailTags focus on displaying classification information, whether it is building multi-level navigation or displaying the description, images, and other information of the classification itself on the classification page, they are indispensable.
  • pageListandpageDetailIt is used to manage and display independent pages such as "About Us", "Contact Information", etc.
  • tagList/tagDetail/tagDataListIt allows us to aggregate and display relevant content based on the tag system, providing users with more dimensions of content discovery paths.
  • navListTags are used to build the navigation menu of a website, which can flexibly display first and second-level navigation links based on the navigation categories set in the background, and can even embed category or product lists in the navigation menu.
  • Furthermore,ifandforLogical control labels, as wellsafeUsed for safely outputting HTML content,renderAnd for rendering Markdown content to HTMLtruncatecharsFilters used to truncate long text and add ellipses, providing strong support for the dynamic logic and content embellishment of templates.

Through the above mechanism, AnQiCMS makes the flexible display of content easily accessible.Whether it is to build a complex product display website, a multi-dimensional content information platform, or an enterprise website that requires highly personalized services, AnQiCMS can provide powerful and flexible technical support.It is not just a content publishing tool, but also a tool to help operators maximize the value of content.


Frequently Asked Questions (FAQ)

  1. How to display content from different content models in different areas of a page?AnQiCMS supports calling different functions in the same template file,archiveListLabel, and specify differentmoduleIdandcategoryId

Related articles

How to implement string capitalization or capitalize each word in AnQiCMS templates?

In website content operation, the way text is displayed often directly affects the reading experience and the professionalism of the website.AnQi CMS as an efficient content management system, its powerful template engine provides us with flexible content display capabilities.This includes various string formatting processes, such as what we will discuss today, how to capitalize the first letter of a string, or the first letter of each word.

2025-11-08

How to automatically convert line breaks in the multi-line text entered by the user to the HTML `<br>` tag?

When using Anqi CMS to publish content, we often encounter such situations: when entering text in the content editing box, if it contains multiline information, but when the front-end page displays it, these line breaks disappear, causing the text to be squeezed together and resulting in a poor reading experience.This is usually because HTML defaults to treating newline characters (`\n`) as regular spaces.However, Anqicms provides a very convenient template filter that can help us easily solve this problem, allowing multi-line text to maintain its original formatting on the web page.### Core Function

2025-11-08

How to automatically truncate a long URL and display an ellipsis in the middle when displaying it in AnQiCMS?

In website content operation, we often encounter the problem that long URLs cause poor page layout and affect user experience.Especially on list pages, navigation, or other display areas, if the original URL is displayed without processing, it may take up too much space and even burst the layout.In AnQiCMS, fortunately, we can elegantly solve this problem through flexible template filters, to achieve automatic truncation of long URLs and display ellipsis at the end or at a specific position.

2025-11-08

How to make AnQiCMS automatically identify URLs and email addresses in text and convert them into clickable hyperlinks?

In daily website operations, we often need to mention URLs or email addresses in the article content.If this information is just plain text, users cannot directly click to jump, and they need to manually copy and paste, which undoubtedly increases the complexity of the operation, and may also cause users to lose interest.Fortunately, AnQiCMS provides a very simple and efficient method that allows the website to automatically identify URLs and email addresses in text and convert them into clickable hyperlinks, greatly enhancing the user experience and interactivity of the website.Why automatic recognition and conversion is so important?Imagine

2025-11-08

How to configure AnQiCMS to support the display and switching of multilingual content?

Today, with the increasing popularity of globalization, supporting multi-language content display and switching has become a key factor in expanding the international market and serving diverse user groups.AnQiCMS as an efficient system focusing on enterprise content management fully considers this need and provides a flexible and practical multilingual configuration solution.This article will discuss in detail how to configure and manage multilingual content in AnQiCMS, helping your website easily achieve globalization.### Understanding AnQiCMS multilingual mechanism Before going deeper in the configuration

2025-11-08

How does the static setting affect the display structure of the website URL?

Have you noticed that some website URLs are clear and easy to understand, with the content of the page being evident at a glance, while others are filled with complex question marks and numbers, leaving one puzzled?This difference largely comes from the 'pseudo-static' setting of the website.In Anqi CMS, URL rewriting is a very practical and powerful feature that can profoundly affect the display structure of your website's URL, thereby having an important impact on the website's SEO and user experience.What is pseudo-static and why is it important?First, let's understand what pseudo static is. Usually

2025-11-08

How does AnQiCMS protect the copyright of displayed content through anti-crawling and watermark functions?

In the digital age, the value of original content is self-evident, but the problem of content theft and plagiarism is becoming increasingly prominent.For website owners and enterprises who work hard in creation, how to effectively protect their digital assets has become an important issue.AnQiCMS (AnQiCMS) fully understands this pain point, and from the very beginning of the system design, it has placed content copyright protection at the core position, especially through its built-in anti-crawling interference code and image watermark features, providing users with a comprehensive and efficient content protection strategy.### Content collection prevention: Protect the originality of text thoughts Imagine, the carefully written article you have written

2025-11-08

How to control the display permission of specific content based on user groups and VIP levels?

In website operation, providing differentiated content experience for different user groups is an important strategy to enhance user stickiness and achieve content monetization.The user group and VIP system of AnQiCMS (AnQiCMS) is the key function that helps us achieve this goal.By flexibly setting the display permissions of content, you can easily create paid content, exclusive member articles, or tiered reading services, making your website content more valuable.### Deeply understand the user group and VIP system of AnQi CMS AnQi CMS built-in user group management and VIP system

2025-11-08