Hello! As a website operator who has been deeply involved in AnQiCMS for many years, I am very clear about the importance of efficient content management in attracting and retaining users.Document classification is not only the skeleton of content, but also a key factor in user experience and search engine optimization.Today, let's delve deeply into how to manage document categories in AnQiCMS meticulously and set up exclusive templates for them.

The core role of document categories in AnqiCMS

In AnQiCMS, document classification is not just about content grouping, it is also the foundation of website architecture, user navigation, and SEO strategy.A clear and reasonable classification system can help users quickly find the information they need and improve the usability of the website;At the same time, it can also guide search engine spiders to efficiently crawl and understand the website content, thereby improving the performance of the website in search results.AnQiCMS provides flexible category management features, allowing operators to build personalized content structures according to business needs.

Practice of document classification management in AnQiCMS

Document classification management is an indispensable part of content operation daily work.On AnQiCMS backend, we can perform comprehensive add, delete, modify, and query operations on the website's categories through the 'Document Category' feature under the 'Content Management' module.

When we embark on creating a new category, we will encounter a series of key configuration items:

first, Document modelIt is the primary choice when creating a category. Each category must belong to a specific content model, such as "article model" or "product model".This needs to be paid special attention to because once the category is created and the document model is selected, this model cannot be changed anymore.This emphasizes the need to clarify the nature and attribution of content in advance when planning the classification structure.

secondly,Parent categoryAllow us to nest new categories within existing ones to form a hierarchical structure.This is crucial for building clear website navigation. For example, under 'News Center', you can create subcategories such as 'Industry Dynamics' and 'Company Announcements'.

Category NameIs the category title displayed on the front-end to the user, should be concise and clear, easy to understand. Coordinate withCategory introductionThese descriptions can provide more detailed information for categories, and they are often used as the Description tag content in TDK (Title, Description, Keywords), which has a direct impact on SEO.

In.In Chinese, we can still make more refined settings:

Display orderDetermines the sorting of categories in the front-end list, the smaller the number, the closer to the front the position is.

SEO titleandKeywordsProvided SEO optimization space for category pages, allowing us to set independenttitleandkeywordslabel content to better match the search engine's crawling requirements.

Custom URLIs an important part of the pseudo-static rule. Pseudo-static rules are enabled.{filename}or{catname}When in mode, the custom URL will take effect. AnQiCMS usually automatically generates a pinyin alias based on the category name as the default value, but the operator can manually modify it to ensure uniqueness and SEO-friendliness.

Banner imageandThumbnailIt provides support for the visual presentation of the category page. Operators can upload multiple images as the carousel banner for the category page, or specify one image as the thumbnail for the category, which is used to display in the list or navigation.

Category contentAllow us to add rich main content to the category page, which is very useful in some scenarios where a detailed introduction of the category is needed.

Set a dedicated template for the category

One of the most powerful customization capabilities of AnQiCMS is the ability to specify exclusive templates for document classification, which greatly enhances the flexibility of website design.

Default template rule

AnQiCMS has a set of built-in template naming conventions that can automatically match and apply templates. For the document list page, the default category template is usually{模型table}/list.htmlFor example, if a category belongs to the "article model", its default list page template might bearticle/list.htmlIn addition, the system also supports specifying a template for a specific category, for example{模型table}/list-{分类id}.htmlThis allows you to provide a unique layout for a specific category.

Configure a custom category template

In the 'Other Parameters' of editing the category, there is one namedcategory templateThe field. Here you can enter a custom template filename, for exampledownload.htmlThis means that when accessing the list page of the category, AnQiCMS will no longer use the default{模型table}/list.htmlInstead, it loads the one you specifieddownload.htmlPlease make sure that this custom template file exists in the template design package you are using, otherwise this category page will not open normally.

The placement of the template file

The custom template file needs to be placed in/templateThe current active template directory under the template folder. For example, if your template package name isdefault, then the custom templatedownload.htmlshould be located/template/default/under the directory, or placed according to the folder organization mode you choose{模型table}/download.htmlsuch a path.

template inheritance and subcategories

Below the "Category Template" field, there is also oneApply to subcategoryThe option. By default, the category template will not automatically inherit to its subcategories.If this option is checked, all subcategories under the current category (regardless of whether they have set a custom template), will uniformly use the custom template set by the parent category.This is very practical for the scenario where it is necessary to maintain the consistent style of the subcategory page.

document template under the category

In addition to setting the template for the category list page, AnQiCMS also allows you to specify a uniform template for all documents under a particular categoryDocument TemplateThis means that when you visit the details page of any document under this category, the system will use the template you set here, rather than the template that the document itself may specify (unless the document itself has more specific template configuration).For example, you can specify one for all product articles under the "Product Case" categoryproduct_case_detail.htmlThe template ensures that the display style of all product cases is unified. Similarly, the template file must exist.

Notes on template creation and application.

When customizing templates in AnQiCMS, there are several points that need to be emphasized:

Template files are uniformly adopted:.htmlsuffix, and stored in/templateIn the corresponding template package under the directory. Static resources such as CSS, JS, images, etc. should be placed in/public/static/In the catalog.

AnQiCMS template engine supports syntax similar to Django, variable usage{{变量}}for logical control such as conditional judgments and loops{% 标签 %}, and the corresponding closing tag is required{% end标签 %}. When creating custom templates, you will fully utilize these tags to dynamically render categories and document data. For example, using{% categoryDetail %}Tag to get category details or use{% archiveList %}Tag to get the document list under the category.

Make sure that all template files are saved in UTF-8 encoding to avoid garbled characters issues.

The configuration of custom URLs and pseudo-static rules is closely related.If your website has enabled pseudo-static, then the custom URL of the category will directly affect its access path.When setting a custom URL, ensure its uniqueness within the entire site.

Summary

By using AnQiCMS's flexible document classification management function and powerful custom template support, you can create a highly customized and user-friendly content display effect according to your website's brand image and operational strategy.This not only helps optimize the internal link structure and SEO performance of the website, but also can effectively attract and retain your target users through consistent and attractive visual presentation, helping the marketing and communication of corporate content.


Frequently Asked Questions (FAQ)

1. Why can't I change the document model of the category that has already been created?AnQiCMS was designed to tightly bind categories with content models.Once the category is created and the document model is specified, it cannot be changed.This is to ensure the consistency and stability of the data structure, to avoid errors or confusion in content display due to changes in model type.Therefore, it is recommended to plan in advance the type of content and corresponding model that the new category will carry before creating it.

2. What will happen if I set a custom template for the category, but the template file does not exist?If you specify a custom template in the category settings, but the file is/templateThe current active template package does not exist in the directory, so when accessing the category page, the system will not be able to find and load the template, which usually leads to the page not displaying normally and may even cause error prompts.Therefore, before configuring the custom template, make sure that the corresponding template file has been uploaded and placed in the correct path.

3. Have I set a "document template" for a category, can each single article in this category still have its own independent template?Can be. AnQiCMS provides a flexible template priority mechanism.If you set a 'document template' for a category (which is the default template for all documents under that category), it will serve as a general rule.However, when editing specific documents, you can still specify a more specific exclusive template for the individual document by using the "Document Template" field in the "Other Parameters" of the document.When accessing this document, AnQiCMS will load the template specified by the document itself first, rather than the template set at the category level, which allows for more precise customization of individual important content.