How to customize the display layout of different types of content in AnQiCMS?

Calendar 👁️ 85

Unlock AnQiCMS: The secret weapon for personalized content layout

In the digital age, a website is not just a carrier of information, but also the core of brand image and user experience.A system that can flexibly customize the display layout of content, which is undoubtedly the key to improving operational efficiency and user attraction for small and medium-sized enterprises, self-media operators, and multi-site managers.AnQiCMS with its powerful content model and flexible template mechanism provides us with all the tools to achieve this goal.

Today, let's delve into how to customize the display layout of different types of content in AnQiCMS, making your website content shine with unique charm.

Understand the AnQiCMS content structure: the custom basis

Want to customize the layout, first you need to understand how AnQiCMS organizes content.It introduced the concept of 'content model', which is like a customized skeleton tailored for different types of content (such as articles, products, events, etc.).Each content model can have its own unique fields, such as, the product model, in addition to the title and content, can also have fields such as "price", "stock", etc., while the article model may only need "author", "source".

When you create or edit content in the background, the system will display the corresponding fillable fields based on the content model you choose.These fields are the source of data you call and display in the front-end template.This flexible content model design is the first step in achieving personalized layout, ensuring that you can define the most suitable structure for each content type according to your business needs.

Master the template files and directory structure: the canvas of layout

AnQiCMS template files are unified in use.htmlSuffix, placed in the root directory of the website/templateIn the folder. Each independent template will have its own dedicated folder in this directory, which contains aconfig.jsonFile, defines the name, type (adaptive, code adaptation, PC + mobile) and other basic information of the template.

Inside the template folder, you can use two organization modes: folder mode or flattened file mode. Regardless of the mode, AnQiCMS provides some default template naming conventions, such as:

  • Home: index/index.htmlorindex.html
  • Model Home: {模型table}/index.htmlor{模型table}_index.html(For example:)article/index.htmlUsed for article list page,product/index.htmlUsed for product list page)
  • Document Details Page: {模型table}/detail.htmlor{模型table}_detail.html(For example:)article/detail.htmlUsed for article detail,product/detail.htmlUsed for product detail)
  • Document List Page: {模型table}/list.htmlor{模型table}_list.html(Used to display the document list under a certain category)
  • Single page detail page: page/detail.htmlorpage.html
  • Tab Page: tag/index.htmlortag_index.html(Tag aggregation page),tag/list.htmlortag_list.html(Document list under tag)
  • Additionally, there aremobile/The catalog is specifically used to store mobile template.

It is crucial to understand these default naming rules, as they determine which template the system will load to display your content when no special specification is made.

Fine-tuning control: Specify a dedicated template for specific content

The strength of AnQiCMS lies in the fact that it not only supports default template rules, but also allows you to specify unique display templates for specific categories, documents, or even individual pages.This is like putting a custom-made outfit on your content, making it stand out on the website.

When you edit in the backgroundDocument CategoryYou can find the options 'Category Template' and 'Document Template' in the 'Other Parameters'.

  • Category template:If you want the list page of a category (such as "News Center") to be different, you can enter a custom template filename here (for example,article/news-list.html)。So, when the user visits the "News Center" category, the system will load this specific template.You can even choose to "apply to subcategories", so that all subcategories under this category also follow this template style.
  • Document template:Similarly, if you want all documents under a certain category to use a unified detail page layout, you can specify a document template here (for examplearticle/news-detail.html)

Forsingle page(such as "About Us", "Contact Us"), the "Single Page Template" option is also provided in the page editing interface. If you want the "About Us" page to have a special design, you can create one likepage/about.htmlThe template file, and specify it here.

And forSingle documentWhen publishing or editing, you can find the "Document Template" in the "Other Parameters" to specify an independent template for this particular article or product, for examplearticle/download.htmlUsed to display a unique layout for a download page.

Through these backend settings, you can easily achieve layout customization from global to local, meeting various complex content display needs.

Dynamic data rendering: unlock the powerful capabilities of template tags

Custom template files are just the first step; the key to bringing content to life and achieving diverse layouts lies in the rich template tags provided by AnQiCMS.These tags allow you to retrieve and display various data on the website programmatically, and perform logical judgments and loop operations.

AnQiCMS template tag syntax is similar to Django template engine, variables are enclosed in double curly braces{{变量}}Logic control labels use single curly braces and percent signs{% 标签 %}.

The following are some core labels and their application scenarios:

  1. Global information acquisition:

    • systemLabel: Get the global configuration of the website name, LOGO, filing number, etc., commonly used in the header and footer.
    • contactLabel: Dynamically display contact information, phone numbers, addresses, email addresses, etc., making it convenient for customers to find you at any time.
    • tdkLabel: Flexibly set the page's Title, Keywords, and Description, which is the foundation of SEO optimization.
  2. Content list and details:

    • archiveListLabel: This is a universal tag for retrieving articles and product lists. You can obtain the required document list based on various conditions such as model ID, category ID, recommended attributes, sorting method, and more.For example, display the latest articles on the homepage or specific products on the category page.
    • archiveDetailLabel: Used to obtain detailed information about a single document (article or product), including title, content, images, custom fields, etc.
    • categoryListLabel: Get the category list, which can be used to build multi-level navigation menus or display the category tree in the sidebar.
    • categoryDetailLabel: Get details of a single category, such as category name, description, Banner image, etc., often used for top display on category pages.
    • pageListandpageDetailLabel: Used to retrieve the list of single pages and the details of a single page, commonly used to build independent pages such as "About Us", "Contact Us", etc.
    • tagListandtagDetailTags: Used to retrieve tag lists and details of individual tags, making it convenient for you to build tag clouds or tag aggregation pages.
  3. Navigation and Association:

    • navListLabel: Dynamically generates website navigation menus based on navigation categories set in the background, supports multi-level dropdowns.
    • breadcrumbTag: Automatically generate breadcrumb navigation to enhance user experience and website structure clarity.
    • prevArchiveandnextArchiveTag: Display previous and next documents on the document detail page to guide users to delve deeper into browsing.
    • archiveList with type="related":Get related document lists, enhance the correlation between content.
  4. Logical control and modularization:

    • if else endifLabel: Implement condition judgment, displaying different content or style based on different conditions. For example, determine whether there is a thumbnail to decide whether to display the image.
    • for empty endforLabel: Traverse array or list, commonly used to display article lists, product lists, image groups, etc.
    • includeLabel: Integrate common code snippets such as headers, footers, sidebars, etc. into different templates to achieve code reuse and improve maintenance efficiency.
    • extendsLabel: Implement template inheritance, you can create a base skeleton template (such asbase.html), define the common structure, and then in other page templates

Related articles

How to correctly parse and display Markdown formatted text in article content?

In Anqi CMS, using Markdown format to write articles is an efficient and elegant way of content creation, which makes our content structure clearer and layout more flexible.Especially for technical articles that need to include code, mathematical formulas, and even flowcharts, Markdown editors are an indispensable tool.How can we ensure that these carefully written Markdown texts are correctly parsed and perfectly presented on the website front-end?Let's explore step by step. ### Enable Markdown Editor First

2025-11-09

How to configure pseudo-static URL rules to optimize the search engine display of website content?

In today's internet environment, the search engine display effect of website content is directly related to traffic and conversion.A clear and meaningful URL structure not only enhances user experience but is also an indispensable part of search engine optimization (SEO).AnQiCMS (AnQiCMS) understands this and therefore provides a powerful and flexible pseudo-static URL rule configuration function to help website managers easily optimize URL structure.Why configuring pseudo-static URL rules is crucial for the search engine display of website content?Before getting to know how to configure

2025-11-09

How to implement multilingual front-end display and switching of website content in AnQiCMS?

When building a website for global users, the display and switching of multilingual content are essential.AnQiCMS (AnQiCMS) understands the importance of this requirement and has integrated powerful multilingual support capabilities into the system design from the beginning, helping websites easily achieve internationalization of content. ### The Basics of Content Multilingual Management: Multi-Site Mode One of the core mechanisms for implementing multilingual display of website content in Anqi CMS is its flexible "Multi-Site Management" function.For a truly multilingual website

2025-11-09

How to aggregate and display the content list of multiple article categories on a single page?

In Anqi CMS, implementing a feature to aggregate multiple article category content lists on a single page is a very practical requirement. It can help website administrators organize content efficiently and provide visitors with a more convenient browsing experience.This is commonly applied to the homepage, special pages, or aggregate pages of a website, where we can easily achieve the goal by skillfully using AnQiCMS template tags.### Core Concept: Tag Combination and Nested Loops AnQi CMS provides a flexible template tag system

2025-11-09

How to implement personalized content display on the article detail page?

In website operation, the article detail page is not only a carrier of content, but also a key link for improving user experience, conveying brand value, and even achieving conversion goals.AnQiCMS (AnQiCMS) has provided us with rich features, making the personalized display of article detail pages accessible.It not only helps us meet the diverse needs of content presentation, but also allows each article to appear in front of readers with a refined posture.To create a unique article detail page, we can start with several core functions of Anqi CMS.--- ### One

2025-11-09

How to extend content display options through custom fields in AnQiCMS?

Today, with the increasing refinement of content operation, the way websites present content is no longer just a simple title and text.Whether it is to display product detailed parameters, registration information for activities, or record the professional background of team members, we need a more flexible and structured content management method.AnQiCMS (AnQi Content Management System) is strong in this aspect, providing powerful support through its 'custom field' feature, helping us easily expand content display options and create highly personalized website experiences.Why do we need more flexible options for content display?Imagine

2025-11-09

How can I apply a unique document display template under a specific category?

When managing the content of our website, we often encounter such situations: We want articles under a specific category to be presented in a unique layout or style, distinct from the standard display of other parts of the website.For example, product showcase articles may need to include detailed parameter tables and multi-image carousels, while blog articles focus on smooth reading experience and comment sections.AnQi CMS fully understands the importance of this personalized need and provides a very flexible and intuitive way to achieve this, that is to apply a unique document display template for specific categories.

2025-11-09

What methods does AnQiCMS support to display images and thumbnails?

When building and operating a website, displaying images and thumbnails is an indispensable element in attracting users and conveying information.An excellent content management system (CMS) should provide powerful and flexible image processing capabilities.AnQiCMS performs well in this aspect, it not only simplifies the image management process, but also provides a variety of intelligent display methods, helping us easily create websites with outstanding visual effects and fast loading speed.### Core Image Management Capability: Say goodbye to chaos Firstly, AnQiCMS provides a centralized "Image Resource Management" function

2025-11-09