Hello!As a website operator who has been engaged in AnQiCMS for many years, I am very clear about the importance of efficient content management in attracting and retaining users.The document classification is not only the skeleton of the content, but also the key to user experience and search engine optimization.Today, let's delve into how to manage document categories finely in AnQiCMS and set up exclusive templates for them.
The core role of document categories in AnQiCMS
In AnQiCMS, document classification is not just about grouping content, it is also the foundation of website architecture, user navigation, and SEO strategy.An clear and reasonable classification system can help users quickly find the information they need, improving the usability of the website; at the same time, it can guide search engine spiders to efficiently crawl and understand the content of the website, 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.
AnQiCMS中的文档分类管理实践
Managing document classification is an indispensable part of daily content operation.In 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.
当我们着手创建一个新的分类时,会遇到一系列关键配置项:
Firstly,document modelIs 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, forming a hierarchical structure.This is crucial for building clear website navigation.For example, under "News Center
Category nameIs the classification title displayed to the user by the front desk, should be concise and clear, easy to understand. WithCategory IntroductionThis can provide more detailed descriptions for categories, which are often also used as the Description tag content in TDK (Title, Description, Keywords), having a direct impact on SEO.
InOther parametersEnglish,we can also perform more fine-grained settings:
Display OrderDetermines the sorting order of the category in the front-end list, the smaller the number, the closer to the front.
SEO titleandKeywordsProvided SEO optimization space for category pages, allowing us to set independent for categoriestitleandkeywordsLabel content to better match the crawling needs of search engines.
Custom URLIs an important part of the rewrite rule. When the rewrite rule is enabled{filename}or{catname}When in mode, the custom URL will take effect.AnQiCMS will usually generate pinyin aliases automatically based on the category name as the default value, but operators can manually modify it to ensure uniqueness and SEO-friendliness.
Banner imageandThumbnailThen it provides support for the visual presentation of the category page.Operator can upload multiple images as the carousel Banner for the category page, or specify one image as the thumbnail of the category for display in the list or navigation.
Category ContentAllow us to add rich main content to the category page, which is very useful in scenarios where detailed introduction of categories is required.
Set a dedicated template for categories
AnQiCMS one of the most powerful customization capabilities is to specify exclusive templates for document classification, which greatly enhances the flexibility of website design.
Default template rules
AnQiCMS has a set of built-in template naming conventions, which can automatically match and apply templates. For document list pages, the default category template is usually{模型table}/list.html。For example, if a category belongs to "Article Model", its default list page template might bearticle/list.html。In 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' section of editing a category, there is a field namedCategory TemplateThe field. Here, you can enter a custom template filename, for exampledownload.html. This means that when accessing the list page of this category, AnQiCMS will no longer use the default{模型table}/list.htmlInstead, it loads the one you specifieddownload.htmlTemplate. Please make sure that this custom template file already exists in the template design package you are currently using, otherwise this category page will not open normally.
Template file placement
Custom template files need 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.html就应该位于/template/default/目录下,或者根据您选择的文件夹组织模式,放在{模型table}/download.html这样的路径下。
模板继承与子分类
在“分类模板”字段下方,还有一个Whether to apply to subcategoriesThe options.By default, the classification template is not automatically inherited to its sub-classifications.If this option is checked, all subcategories under the current category (regardless of whether they have set a custom template) will use the custom template set by the parent category.This is very useful for scenarios that require consistent styling of subcategory pages.
Categories document template
In addition to setting templates for the category list page, AnQiCMS also allows you to specify a uniform template for all documents under a categoryDocument template.This means that when you visit the detail 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 has more specific template configurations).product_case_detail.htmlTemplate, to ensure that the display style of all product cases is unified. Similarly, the template file must exist.
Precautions for 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/templateThe template package corresponding to the directory. Static resources such as CSS, JS, images, etc. should be placed in/public/static/In the catalog.
AnQiCMS's template engine supports syntax similar to Django, with variables used{{变量}}logic control such as conditional judgment and loop use{% 标签 %}, and it needs the corresponding end tag{% end标签 %}. When creating custom templates, you will make full use of these tags to dynamically render categories and document data. For example, using{% categoryDetail %}Label gets category details, or use{% archiveList %}Label gets the document list under the category.
Please make sure that all template files are saved in UTF-8 encoding to avoid garbled code issues.
Finally, the configuration of custom URL and pseudo-static rules is closely related.If your website has enabled pseudo-static, the custom URL of the category will directly affect its access path.When setting a custom URL, ensure its uniqueness across the entire site.
Summary
Through AnQiCMS's flexible document classification management function and powerful custom template support, you can create highly customized, user-friendly content display effects based on the brand image and operational strategy of your website.This not only helps optimize the internal link structure and SEO performance of the website, but also effectively attracts and retains your target users through consistent and attractive visual presentation,助力企业内容的营销和传播.
Common Questions and Answers (FAQ)
1. Why can't I change the document model of the created categories?AnQiCMS is 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 content display errors or data chaos due to changes in model type.Therefore, it is recommended that you plan in advance the content type that the new category will carry and the corresponding model.
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 in/templateThe current activity template package does not exist under 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 result in error prompts.Therefore, make sure that the corresponding template file has been uploaded and placed in the correct path before configuring the custom template.
3. Can an individual article within a category that has a 'document template' set still have its own independent template?Can be.AnQiCMS provides a flexible template priority mechanism.If you have set a 'document template' (i.e., the default template for all documents in a category) for a category, this will serve as a general rule.However, when editing specific documents, you can still specify a more specific dedicated template for a single document by selecting the 'Document Template' field under the 'Other Parameters' in the document.When accessing this document, AnQiCMS will first load the template specified by the document itself, rather than the template set by the category hierarchy, which allows you to customize individual important content more finely.