How can you customize the display layout of different types of content using a flexible content model?

Calendar 👁️ 82

In website operation, we often encounter such a need: different content types require different display methods.The layout of a news article may be very different from that of a product detail page, and a team member introduction page may have its own unique style.The flexible content model of AnQiCMS is designed to solve this pain point, allowing us to deeply customize the structure of the content and the final display layout, thus providing a** browsing experience for visitors.

Understanding the core value of the content model

One of the core advantages of Anqi CMS is its 'flexible content model' feature.In simple terms, a content model is like the 'skeleton' and 'identity proof' of the content.It defines what fields a certain type of content should include (for example, an article has a title, author, and publication date;The product has a name, price, stock, and a set of product images, as well as the types of these fields.

The flexibility brings great value to users. We can customize various content structures according to business needs, such as:

  • Article model:Including title, content, keywords, abstract, cover image.
  • Product model: Contains product name, detailed description, price, stock, product parameters (such as color, size), multi-angle images.
  • Case model: Contains case title, customer name, completion date, case details, related images.
  • Team member model:Contains name, position, personal introduction, avatar, social media links.

By creating dedicated models for each content type, not only can we manage and enter content more efficiently, but more importantly, it lays a foundation for customizing the display layout of these contents on the front end.

Build your exclusive content model

To start creating or adjusting the content model, we can go to the 'Content Management' section of the Anqi CMS backend and find the 'Content Model' option.The system usually comes with common models such as articles and products, and we can choose to modify them or add custom models as needed.

When creating a new model, you need to pay attention to the following key points:

  1. Model name and table name:The model name is the Chinese name displayed on the back end, which is convenient for identification.The model table name is the identifier for data stored in the database, it is usually recommended to use lowercase English letters, and once set, it cannot be changed, so it needs to be handled with care.
  2. URL alias:This name will be used in the frontend URL, which is very important for SEO, and it is also recommended to use lowercase letters in English.
  3. Custom field:This is the core flexibility of the content model. We can add various custom fields to precisely define the content structure.
    • Single-line text:Applicable for brief information, such as product model, author name.
    • Number:Applicable for prices, inventory, quantities, etc.
    • Multi-line text:Applicable for longer descriptions, such as product introductions, article summaries.
    • Single choice/Multiple choice/Dropdown choice:Applicable to preset options, such as product colors, service types.
    • Image set:Very suitable for product display, can upload multiple images.
    • Mandatory?:Ensure that important information is not missed.

For example, when creating a “product” model, we can add fields such as “price” (numeric), “product features” (multi-line text), “color” (multiple choices), and “product gallery” (image set).These custom fields will be directly associated with the content entry interface and will be called in the subsequent template design.

精细化管理的内容与分类

After the content model is set up, when publishing content, we can select the corresponding category, and each category will be bound to a content model.This means that when we select a category bound to a 'product model', the content entry interface will automatically display all the fields defined in the product model, making content entry structured and efficient.

Moreover, AnQi CMS also supports specifying custom templates for specific categories or independent documents. This is a crucial feature, meaning that we can:

  • Use a unified article list and detail page template for all 'News' categories.
  • Use a standard detail template for all products under the 'Company Products' category, but customize a more attractive detail page template for the 'Star Products' subcategory.
  • Even for an article specially recommended or a single page about us, design a completely exclusive layout.

By setting the category or document in the background, enter the custom template file name (for exampleproduct-special.html), and this purpose can be achieved.

Flexiblely define the display layout of the content

After we have defined the content model and customized the application method of the template, the next step is to implement the display layout of these contents in the template file.The AnQi CMS template system is based on syntax similar to Django, which is powerful and easy to learn.

  1. Template file organization:The template files of Anqi CMS are located in/templatethe directory, which is usually organized according to content type and page function. For example,article/detail.htmlit may be the default template for the article detail page,product/list.htmlIt could be the default template for the product list page. When we want to customize the layout, we can create a new template file, such asproduct/detail-custom.htmlThen, in the background, it is assigned to a specific product category or the product itself.

  2. Application of core tags:In the template file, we mainly use various tags provided by Anq CMS to obtain and display content.

    • archiveListandarchiveDetailTag: This is the core tag for obtaining the list and details of content (documents).moduleId/categoryIdWith parameters, we can accurately obtain the required content.
      • Standard fields for displaying content (such as)Title/Description), you can use it directly{{item.Title}}or{{archive.Description}}.
      • For fields customized in the content model, we can directly access them by{{item.自定义字段名}}or{{archive.自定义字段名}}Visit. For example, if the product model has onepricefield, it can be used in the detail page template{{archive.price}}to display.
      • If there are many custom fields, or if you want to handle it in a more flexible way,archiveParamsThe tag can get all the custom parameters of the current document and thenforloop through and display, such as:

Related articles

How to implement unified content management and front-end display for AnQiCMS?

In the digital age, many enterprises and content operations teams need to manage multiple websites, which may involve different brands, product lines, regions, or multilingual content.The traditional approach often means deploying multiple independent CMS systems, leading to high maintenance costs, repeated content updates, and difficult data integration.How to achieve unified management of content across multiple sites and efficient front-end display in the face of such challenges has become an urgent problem to be solved.AnQiCMS (AnQi Content Management System) is precisely in this context, providing users with a simple and powerful solution. AnQiCMS

2025-11-09

How to customize new parameters in the AnQiCMS backend settings and display them in the front-end template?

In Anqi CMS, to meet the personalized and flexible content display needs of the website, you can easily customize new parameters and call these parameters to display in the front-end template.This greatly enhances the website's customization capabilities, whether it is to display specific contact information, additional attributes of articles, or special configuration of single pages, it can do so with ease. AnQi CMS provides two main ways of custom parameters: **global parameters at the system/contacts level** and **custom fields at the content model level**. Understand these two methods and their applicable scenarios

2025-11-09

How to define macro functions in templates to reuse commonly used content display code snippets?

In the development of website content management system templates, we often encounter situations where we need to repeatedly write the same or similar code snippets to display specific types of content.For example, each article card in the blog article list, each product feature item on the product detail page, although their content is different, their structure and style are highly similar.If you copy and paste this code manually every time, not only is it inefficient, but you also have to repeat the laborious work in multiple places when you need to make modifications, which is very prone to errors.AnQiCMS (AnQiCMS) is an efficient content management system, its template engine supports similar

2025-11-09

How can you reference and overwrite the base master template (extends) in a template to unify the display style?

In the world of AnQiCMS, building a website with a unified appearance, easy to manage, and efficient to update is a common pursuit of each content operator and developer.Imagine if each page of the website needed to be designed individually for the header, footer, and sidebar, then the amount of work required to modify the logo, navigation menu, or copyright information would be enormous.Luckyly, AnQiCMS cleverly utilizes the template inheritance mechanism, allowing us to easily achieve a unified display style while maintaining flexible content updates

2025-11-09

How does the AnQiCMS website support the switching of multilingual content and accurate display?

Today, with the deepening of globalization, the international promotion of website content has become an important topic for many enterprises and operators.How can different language users smoothly browse your website and obtain the necessary information, which is the key to improving user experience and expanding the global market.AnQiCMS, as an efficient and flexible content management system, provides a powerful and practical multilingual solution in this regard. ### AnQiCMS's Multilingual Ability: Opening the Door to the Global Market One of the core strengths of AnQiCMS is its comprehensive "multilingual support" feature.This means

2025-11-09

How do static rules affect the display of website URLs and optimize search engine inclusion?

In website operation, the URL plays a more important role than many people imagine.It is not only the address when the user visits the page, but also a key link for search engines to understand and evaluate the content of the web page.Today, let's delve into how pseudo-static rules affect the display of website URLs and the significant help they bring in optimizing search engine inclusion.Why do website URLs need 'pseudo-static'? Imagine, when you see two links on the search engine results page: `www.example.com/article.php

2025-11-09

How to control the front-end display of articles at specific times through the scheduling publishing feature?

In website content operation, the timing of release is often a key factor affecting the reach of content to users and achieving operation goals.In order to maintain the rhythm of content updates or to accurately target market activities, manual operations often take a lot of time and effort, and are even prone to errors.Good that AnQiCMS (AnQiCMS) is well-versed in this, providing us with a very practical feature - scheduled publishing, which can help us easily control the display time of content on the front end.Why scheduling posts is so important for content operation?Imagine

2025-11-09

How does AnQiCMS improve user experience and loading speed through static caching in content display?

## AnQiCMS: Build ultra-fast and smooth user experience with static caching In today's digital age, the loading speed and user experience (UX) of websites have become key factors determining success or failure.A slow website not only loses visitors but may also damage the brand image and search engine rankings.AnQiCMS deeply understands this requirement, through its powerful static caching mechanism, bringing significant speed improvement and a better user experience to the website.Next, we will delve into how AnQiCMS cleverly uses static caching to make content display both fast and stable

2025-11-09