How to apply an independent template file for a specific category or single page in AnQiCMS?

Calendar 👁️ 74

In AnQiCMS, in order to make your website more personalized and flexible, you can apply independent template files to specific content categories, single pages, or even single articles.This ability allows you to design exclusive visual styles and functional layouts for different content types or important pages, greatly enhancing the customization degree of the website.AnQiCMS provides two main ways to achieve this goal: one is to rely on preset naming conventions for automatic matching, and the other is to manually specify template files in the background.

1. Priority-based automatic matching

AnQiCMS designed a smart template matching mechanism.This means that as long as your template file follows the specific naming rules, the system can automatically identify and use them during page rendering, saving you the extra steps of configuration in the background.This method is especially suitable for those structured, numerous and regular personalized pages.

In particular, AnQiCMS supports the following conventions:

  • List pages for specific categories:If you want a list page of content under a specific category (for example, category ID is:10The article category has a unique layout style, you can create a file named in the current theme template folder{模型table}/list-{分类ID}.html. For example, if the table name corresponding to your article model isarticleAnd you want to create a separate list template for the category with ID10Then you need to create a namedarticle/list-10.htmlThe file. When the user accesses the list page of this category, the system will automatically call this template.
  • For the detail page of a specific article or product:Similarly, if you want a specific article or product (such as, one with ID of5) to display a unique detail page style, you can create one named{模型table}/{文档ID}.htmlfile. For example, for an ID of5article, you can createarticle/5.htmlfile. This template will be enabled when this specific article is accessed.
  • details page for a specific single page:For some important single pages on your website (such as, pages with ID2), you can create a file namedpage/{单页面ID}.html, for examplepage/2.html. The system will automatically apply this template when accessing the single page.

These template files that follow the naming conventions must be placed in the current active theme template folder (usually/template/您的主题名/)

2. Flexibly specify the template file in the background

In addition to the convenience of automatic matching, AnQiCMS also allows you to manually specify template files for specific content in the background.This approach provides greater flexibility, especially suitable for scenarios where you want to use custom naming, or need to apply specific templates to content accessed through aliases (URL tokens).

Specify an independent template for categories

If you need to set a custom template for a category, such as a special download category or a news category:

  1. First, log in to the AnQiCMS backend management interface, navigate to the 'Content Management' menu, and select 'Document Classification.'
  2. In the category list, find the category you want to modify, click "Edit", or set it when adding a new category.
  3. In the 'Other Parameters' section of the category editing page, you will find a field named 'Category Template'. Here, you can enter the name of your custom template file, for exampledownload.htmlorcategory-news.html.
  4. If all subcategories under this category also need to follow this template, remember to check the option 'Apply to subcategories'.
  5. Additionally, if you want all the article detail pages under this category to use the same custom template, you can enter the corresponding template file name in the 'Document Template' field.

Specify an independent template for the single page

For single pages such as 'About Us', 'Contact Us', etc., you can also specify a dedicated template:

  1. In the background, go to the "Page Resources" menu and select "Page Management".
  2. When editing or creating a single page, find the "Single Page Template" field in the page settings.
  3. Enter the template file name you have prepared for this single page, for exampleabout-us.html. The document also mentions that you can even name the template file according to the alias of the single page (such asabout) to name the template file aspage/about.htmlThen fill in the "Single Page Template" field in the background.about.htmlThe system will recognize automatically.page/Prefix).

Specify an independent template for a specific article or product.

For some particularly important articles or products, even if they belong to the same category, you can allow them to have an independent detail page layout:

  1. Under the "Content Management" menu, go to "Document Management" or "Product Management", find and edit the article or product you want to set up.
  2. In the "Other Parameters" area of the editing page, you will find a "Document Template" field.
  3. Enter the filename you have designed for this specific content here, for example,product-special-offer.html.

**Practice and Precautions

  • Template file location:Whether automatically matched or manually specified, all custom template files must be placed in the AnQiCMS theme folder currently active. For example, if your theme name isdefaultthencategory-news.htmlThe file should be located/template/default/category-news.html.
  • File extension:AnQiCMS template files are unified in use.htmlAs a suffix.

Related articles

How to conveniently introduce common header and footer code snippets in AnQiCMS templates?

In website development and operation, the header (Header) and footer (Footer) are almost indispensable parts of each page.They carry important content such as navigation, brand identity, copyright information, and contact details.However, if each page were to be written independently with this code, it would not only cause a lot of redundant work, but it would also make subsequent modifications and maintenance extremely complex.Imagine if a website has hundreds of pages, and every time you need to modify the navigation menu or the footer copyright information, you have to manually adjust each one individually. That would be so inefficient and prone to errors.Luckyly, AnQiCMS

2025-11-07

Does AnQiCMS support customizing the display style and content of 404 and 500 error pages?

In website operation, every detail of user experience is crucial, even when users accidentally visit a non-existent page (404 error) or when there are internal issues with the server (500 error), a well-designed, friendly error page can effectively reduce user loss and even guide them back to the correct path.AnQiCMS (AnQiCMS) fully understands this and provides users with a flexible way to customize these critical error pages, ensuring that the website maintains a professional and consistent user experience in any situation.### Core Feature Revelation

2025-11-07

How to flexibly display personalized field content on the front-end page after customizing the content model?

With the increasing diversity of modern website content, relying solely on traditional content types such as 'articles' or 'products' often fails to meet complex business needs.The AnQiCMS custom content model feature is specifically designed to address this challenge, allowing us to create highly customized content structures based on actual business scenarios.But how can we carefully design these personalized contents in the background and then flexibly and efficiently present them on the website front-end?This requires us to deeply understand the powerful template tag system of AnQi CMS.###

2025-11-07

How does AnQiCMS utilize modular design for template secondary development and personalized display adjustment?

AnQiCMS is an enterprise-level content management system based on the Go language, and its powerful modular design is one of its core advantages.This design concept is not only reflected in the system architecture, but also deeply affects the flexibility of secondary template development and personalized display adjustment, allowing website operators to easily create unique and highly customizable content platforms. **The Foundation of AnQiCMS Modular Design** AnQiCMS can achieve efficient and flexible template customization, which is inseparable from its underlying modular architecture.

2025-11-07

How to configure the pseudo-static rules of AnQiCMS to optimize URL structure and improve search engine friendliness?

The URL structure of a website, like a business card, not only displays to users but also is an important clue for search engines to understand the content and hierarchy of the website.A clear, concise, and semantically rich URL that can greatly enhance user experience and significantly improve the search engine optimization (SEO) of a website, helping content achieve better rankings.Our CMS is well-versed in this, built-in with powerful static feature, allowing website operators to easily configure and optimize URL structure.Why is the structure of URL important for SEO?Dynamic URLs typically contain question marks, equals signs, and various parameters, such as

2025-11-07

How to set up the 301 redirect function of AnQiCMS to avoid SEO negative impact after content adjustment?

In website operations, the continuous optimization and adjustment of content is the norm, whether it is to redesign pages, adjust the classification structure, or delete outdated content, these operations may cause the original URL of the website to change.When these changes occur, if not handled properly, they may have a negative impact on the website's search engine optimization (SEO) performance, such as traffic loss, ranking decline, and even damage to user experience.Luckyly, AnQiCMS provides a complete 301 redirect management feature that can help us effectively avoid these issues.###

2025-11-07

How to generate and manage a website's Sitemap in AnQiCMS to ensure effective crawling by search engines?

In website operation, it is crucial to ensure that search engines can efficiently crawl and index your content.A sitemap (site map) is like a detailed website navigation map, clearly telling search engines what pages are on your website, how important they are, and when they were last updated.AnQiCMS is a system focused on enterprise-level content management, which provides convenient and powerful functions for generating and managing Sitemaps, helping your website to be better understood and indexed by search engines.### AnQiCMS Automatically Generated

2025-11-07

How to configure the Robots.txt file through the AnQiCMS backend to control the crawling behavior of search engines?

## Easily configure Robots.txt using AnQiCMS: Precisely control the search engine crawling behavior In the many aspects of website operation, it is crucial to allow search engines to efficiently understand and crawl your website content.And the `Robots.txt` file is the first door of communication between you and the search engine, playing the role of a 'traffic commander' for the website, directing the search engine crawlers (Crawler) which pages can be accessed and which pages should not be accessed.AnQi CMS understands the importance of SEO, therefore will Robots

2025-11-07