In website operation, we often hope to design unique display styles for different content types or specific pages.For example, a news article may require a concise and clear list style, while a product introduction may focus more on pictures and detailed parameters; the 'About Us' page often needs an independent design to reflect the brand image.Auto CMS (AutoCMS) understands the importance of these personalized needs, providing flexible template customization features, allowing you to easily create a unique visual experience for different parts of the website without delving into code.

The AnQi CMS is developed based on the Go language, and its template engine adopts syntax similar to Django, making the creation and modification of templates very intuitive and efficient.It not only supports adaptive, code adaptation, and PC+mobile independent site modes, but more importantly, it allows us to specify a completely different display template for specific categories, single pages, or even individual documents, thus greatly enhancing the display power and operational flexibility of website content.

How can we operate specifically to customize independent display templates for different categories or pages on a website? In fact, the whole process is very simple, mainly focusing on the term “Prepare template files" and "Background specified applicationThese two core steps are expanded.

I. Customize exclusive templates for website classification.

Imagine, your website has news categories, product display categories, and even case sharing categories.Each category has different content features and user focus points, which naturally requires different layouts to optimize the user experience.The auto CMS allows you to specify an independent list page template for any category.

Operation Steps:

  1. Create or select template files:Firstly, you need to create a new HTML file under the directory of the current template theme, as the exclusive template for this category. For example, if you want to design a grid layout for a product category, you can create a file namedproduct/grid_list.htmlThe file(productis the table name of the model belonging to this category, usuallyarticleorproduct)。This file will contain all the HTML structures and data calling logic that you want to be displayed on the list page of this category.
  2. Apply template in background:Log in to the security CMS backend and navigate to the "Content Management" module under "Document Category.Find the category of custom templates you want to edit, click “Edit”.On the "Other Parametersproduct/grid_list.htmlPlease note that the main template directory name should not be included, as the system will automatically recognize it.
  3. Inheritance rules:If you want this custom template to apply to all subcategories under the current category, you can find the option 'Apply to Subcategories' below the 'Category Template' field and check it.Otherwise, the child category will continue to use its parent category or the default template of the model.
  4. Default naming conventions:It is interesting that, Anqi CMS also provides a convenient default naming convention. If you name the template file{模型table}/list-{分类ID}.html[for example]article/list-10.html),then this template will be automatically recognized and applied to the article category with ID 10 by the system, saving the additional backend configuration steps.

Through this method, you can display your product categories with exquisite grid images, while the news category maintains the traditional title list, with each section exuding professionalism.

English, for specifying an independent template for a single document

Not all articles or product detail pages are suitable for a unified template.Some special documents, such as software download pages, important special reports, or detailed product specification comparison pages, may require a more unique layout.

Operation Steps:

  1. Prepare an independent template:Similarly, you need to prepare a separate template file for this special document. For example, a software download page can create aarchive/download_page.html) file (archiveThe default table name for the article model is usually).
  2. Specify in the background:In the Anqi CMS backend, go to 'Content Management' -> 'Publish Document' or 'Edit Document'.On the document editing page, find the 'Document Template' field in the 'Other Parameters' area.archive/download_page.html.
  3. Model table naming conventions:Similar to categories, documents also support default naming conventions. If you name the template file{模型table}/{文档ID}.html[for example]article/123.html),那么ID为123的文章将自动应用此模板,无需后台手动设置。

This feature enables operations personnel to optimize the display effect of each key content specifically, whether for higher conversion rates or a better reading experience.

Three, for custom display template of a specific single-page

For independent and usually content-light pages like “About Us,” “Contact Information,” and “Terms of Service,” having a unique layout can better convey brand information or guide users to complete specific actions.

Operation Steps:

  1. Create a single-page template:Create an HTML file for this single page under your template theme directory. For example, create apage/about_us.html.
  2. background association:Login to the security CMS backend, go to 'Page Resources' under 'Page Management'.Find the single page you want to customize, click "Edit".page/about_us.html.
  3. Default naming conventions:Single-page also supports the default naming rules, you can name the template.page/{单页ID}.html[for example]page/5.html), the system will automatically apply this template to the single-page with ID 5.

This high degree of customization makes your website stand out from the crowd, with every corner exuding unique charm.

Tips for storing and naming template files:

It is crucial where to place and how to name the template files when customizing templates. All template files should be placed in/templatethe theme directory you are using under the directory/template/default/)。In the background, when filling in the template name, you only need to fill in the path and filename relative to the theme directory, for examplearticle/detail.htmlorpage/my_custom_page.html.

Good file organization habits can make your template management clearer, for example, place templates related to articlesarticle/in the folder, and those related to productsproduct/In the folder. In addition, by taking advantage of the powerful template tag function of the Anqi CMS, you can flexibly call various types of data from the website in custom templates, realizing rich and diverse content display.

Through these features, Anqi CMS not only provides an efficient content management backend, but also gives you complete control over the website's frontend presentation, allowing your website to stand out among its peers.


Common Questions and Answers (FAQ)

Q1:Custom template files should be placed in which directory of AnQi CMS?A1:Your custom template files need to be placed in the root directory of AnQi CMS./templateIn the folder, then go into the directory of the theme template you are currently using (for example,/template/default/). Under the theme directory, you can create subdirectories according to the file type (for example,article//product//page/),Put the corresponding custom template file in it.

Q2:If I set a custom category template, will the document detail page under this category automatically use this template?A2:Doesn't know.Custom "Category Template" only affects the list page display of the category.The document details page has an independent "document template" setting.If you want all document detail pages under a category to use the same custom template, you need to find the 'Document Template' field to set it on the category edit page, or specify it separately on the edit page of each document.

Q3:In the security CMS background, when filling in the template name, do you need to include.htmlthe suffix?A3:Yes, when filling in the template name in the background, you need to include the.htmlfull suffix, for examplearticle/my_special_list.html. Also, make sure the path is relative to your current theme template directory.