Can we achieve the matching of the refined content model and detail page style when using AnQiCMS?The answer is affirmative, and AnQiCMS is very flexible and powerful in this aspect.
The powerful foundation of content models
One of the core strengths of AnQiCMS is its 'flexible content model' feature.The system incorporates 'Article Model' and 'Product Model' as common content types, and also allows users to fully customize new content models based on their business needs.For example, you can create a 'Case Model' to showcase company projects, or a 'Event Model' to publish marketing promotion content.
Every custom content model is not just a name; it also defines the unique fields for this type of content.For example, a product model can have fields such as 'price', 'stock', 'brand', etc., while an article model may have fields such as 'author', 'source', 'recommendation level', etc.These customized fields are the foundation for differentiated detail page styles, as they determine which data can be called and displayed in the template.
The core mechanism of detail page style customization
The key to AnQiCMS displaying different detail page styles for different content models lies in its intuitive and powerful template naming conventions. In the template root directory of AnQiCMS (/templateUnderneath, we can create dedicated folders for each content model and place the corresponding detail page template files in these folders.
In particular, the system will look up the corresponding template based on the 'model table name' of the content. For example:
- For content published through the 'Article Model', AnQiCMS will default to searching for the location of
/template/{你的模板目录}/article/detail.htmlthe file. - And for content published through the 'Product Model', it will look for
/template/{你的模板目录}/product/detail.html.
This means that we only need to create corresponding folders for different content models (the folder names are usually consistent with the English table names of the models) and design their respectivedetail.htmlTemplates can give articles their layout and products their style without affecting each other.This convention is greater than the configuration design, greatly simplifying the template development process, allowing us to focus on the design itself without having to perform complex background association settings.
finer granularity control
The flexibility of AnQiCMS goes beyond the model level.If we are under the same content model and encounter a specific article, product, or page that requires a different display, it also provides a solution.
When editing a single document (such as an article or product) in the background, we will find a "Document Template" setting option. Here, we can specify an independent template file for this particular document, for example,custom_article_detail.htmlThe system will prioritize using this specified template, overriding the default detail page style of its associated content model, thereby meeting more personalized display needs.
This flexible customization capability extends to category pages and single pages:
- Category Template:We can set a dedicated list page template for a specific category (for example,
{模型table}/list-{分类ID}.html),Let different categories of content lists present different styles. - Single page template:For single-page templates such as "About Us
page/about.htmlMake sure these special pages also have a customized appearance.
Dynamic presentation of template content
How can we dynamically load and display content in these detail page templates after we have designed exclusive detail page templates for different content models?The template tag system of AnQiCMS (using Django template engine syntax) provides strong support.
byarchiveDetailTags, we can easily obtain all standard field information of the current document, such as the title (Title)、Content()Content)、Publish Time()CreatedTime)et cetera.It is even more surprising that custom fields defined in the content model, such as 'price' and 'stock' in the product model, or 'article source' in the article model, can be directly displayed in the corresponding detail page template through simple tag calls.