On the day when digital content is increasingly important, the way websites present their content directly affects user experience and brand image.AnQiCMS (AnQiCMS) understands this and therefore integrated highly flexible template customization capabilities from the very beginning of the system design, allowing users to accurately control the display styles of various types of content such as articles, products, categories, and even single pages.This is not just a simple theme change, but goes deep into every content block, allowing every detail of the website to be presented according to your vision.

Understanding the core of AnQiCMS templates

To precisely control the display of content, you first need to understand the template mechanism of AnQiCMS.It adopts a syntax similar to the Django template engine, which is intuitive and easy to learn, and can be quickly mastered by those familiar with front-end development.The template file is.htmlsuffix and stored in/templateIn the directory, while all CSS, JavaScript, images, and other static resources have their own/public/static/directory for management, maintaining good separation.

AnQiCMS templates support various modes, including adaptive, code adaptation, and independent modes for PC and mobile terminals, which means you can design the most suitable interface for users of different devices. You will frequently use double curly braces within the template{{变量}}Output data, as well as single curly braces and percent signs{% 标签 %}To implement logical control, such as conditional judgment and loop traversal, these are the basics of building dynamic pages.

Content Model: Defines the skeleton of displayed content

In AnQiCMS, the 'Content Model' is the foundation of all content customization.It not only determines what type of content you can post, but more importantly, it defines what information each type of content can include.The system has built-in "Article Model" and "Product Model", but the real strength lies in the ability to create new content models based on your business needs and add unique custom fields to them.

Imagine if your "product model" needs to display "brand", "model", "inventory" and other information, and if your "article model" needs "author", "source" and other fields, you can easily define them in the background.These custom fields can be single-line text, numbers, multi-line text, or even single-choice, multi-choice, or dropdown selections.In this way, you have provided a rich and structured data source for the template, the task of the template is to present these data in an aesthetic and practical way.

Precisely control the display style of articles and product detail pages

For articles and product content items such as these, AnQiCMS provides multi-level template control, allowing you to adjust styles from the macro to the micro.

General detail template: Usually, we will have a default detail page template, such as{模型table}/detail.htmlfor examplearticle/detail.htmlorproduct/detail.html), this template will handle the detail display of all content under the model

Specific content templateWhen certain articles or products require special display effects, you can specify a custom template for them individually. For example, a special "download" article may requiredownload.htmlTemplate, simply fill in the "Document Template" field when editing the article in the backgrounddownload.htmlThat's it. The system even supports template naming based on ID, such asarticle/10.htmlIt will be automatically applied to the article with ID 10.

In the template,archiveDetailTags are the core to obtain article or product detail data. You can use it to get the titleTitle、ContentContent、ThumbnailLogoorThumband even a set of imagesImages. If you define custom fields (such as the product's 'origin'), you can also call them directly in the template. For rich text content,{{archive.产地字段名}}.|safeThe filter ensures that HTML code is parsed correctly instead of being escaped, while|renderThe filter can be used to render Markdown content as HTML. In addition,prevArchiveandnextArchiveTags can help you easily build the previous/next article