How to set up independent display templates for articles, products, or single pages?

Calendar 👁️ 64

How to set up independent display templates for articles, products, or single pages in Anqi CMS?

In website operation, we often encounter such needs: a special article needs a unique layout to highlight its importance, a product needs a dedicated display page to improve conversion rates, or a core single-page like "About Us" needs a distinctive design to strengthen the brand image.AnQi CMS understands the importance of this flexibility for content operation, and therefore it provides a very convenient way for us to set independent display templates for articles, products, and even single pages.

The core of this feature is to decouple content from its presentation.That is to say, you can edit the content in the background without worrying about its final display style, as the style can be easily implemented according to your needs by switching templates.

Understanding the template mechanism of Anqi CMS

The Anqi CMS template system uses syntax similar to Django, template files are usually named with.htmlsuffix and stored in the root directory of the website./templateIn the folder. Each set of templates has its own independent directory.When we set an independent template for specific content, in fact, it is telling the system: 'When accessing this content, do not use the default style, but use the template file I specify to render it.'

This flexibility not only allows designers to express themselves freely, but also enables operation personnel to quickly adjust the page layout according to the strategy of content marketing, to adapt to different promotional activities or content types.

Set independent display templates for articles and products

Articles and products in Anqicms are all under the document under the 'Content Model', and their template setting logic is similar.

Imagine you have an annual report that you want to have a more professional, illustrated dedicated page; or you have a flagship product that needs a special layout with modules including videos, user reviews, etc.At this point, it can be specified with an independent template.

Specific operation steps:

  1. Create or prepare a custom template file:First, you need to be in the directory of the currently used template theme (for example:/template/default/),According to your content model, create a new HTML file.

    • If your content is "article", you can create a similararticle/special-report.html.
    • If your content is "product", you can create a similarproduct/flagship-showcase.htmlfile. Make sure the content of this file includes the unique layout and style you want.
  2. Specify the template in the background:Next, enter the Anqi CMS backend, find the settings you need.article or product:

    • Click on the left menu 'Content Management' -> 'Document Management'.
    • Find the target article or product and click "Edit".
    • Scroll down to the "Other Parameters" section on the edit page, and you will see a field named "Document Template" input box.
    • Here, enter the relative path and filename of the custom template file you just created. For example, if you createdarticle/special-report.htmljust fill inspecial-report.htmlit will be recognized automatically by the system)articledirectory).
    • Save your changes.

After completing these steps, when the user visits this specific article or product detail page, Anqi CMS will automatically call the one you specifiedspecial-report.htmlorflagship-showcase.htmltemplate to display the content.

Set an independent display template for the category list page

Sometimes, you may want a specific category, such as "News Updates" and "Success Stories", which, although both are article categories, have very different list display formats.News may need concise titles and publication times, while successful cases may need to highlight thumbnails and short descriptions.

Specific operation steps:

  1. Create or prepare a custom template file:Similarly, create a list page template under your theme directory based on the content model.

    • For example, you may create one for the “news” category.article/list-news.html.
    • Create a category for "Successful Cases".article/list-cases.htmlThese template files will be responsible for rendering the style of the article list under this category.
  2. Specify the template in the background:Enter the Anqi CMS backend and find the settings you need to set up.Category:

    • Click on the left menu "Content Management" -> "Document Category".
    • Find the target category and click "Edit".
    • Scroll down to the "Other Parameters" section on the edit page, and you will see a field named "category template" input box.
    • Enter the relative path and file name of the custom category list template file you created. For example, if you createdarticle/list-news.html, then fill inlist-news.html.
    • Additionally, there is also a “Apply to subcategoryThe option. If you want this custom list template to also apply to all subcategories of the current category, you can check it.
    • Save your changes.

After setting this, when visiting the list page of the category, the page will use the one you specifiedlist-news.htmlorlist-cases.htmlto display the content.

A little tip:In the category settings, in addition to the 'Category Template', there is also an 'Document Template' option.

  • The 'Category Template' controlsthe display style of the category list page.
  • The 'Document Template' controlsAll documents under this categoryThe display style of the detail page. For example, you can set a special display style for the list page of "Product Category A".product/list-grid.htmlThe template specifies that all product detail pages in this category should use itproduct/detail-fancy.htmlThe template. This hierarchical control makes content display more refined

Set an independent display template for a single page

Web pages such as "Contact UsTailor-made unique designs can effectively improve user experience.

Specific operation steps:

  1. Create or prepare a custom template file:Create a new HTML file in your template theme directory.

    • For example, you may create one for the "About Us" page.page/about-us.html.
    • Create one for the "Contact" page.page/contact-page.html.
  2. Specify the template in the background:Enter the Anqi CMS backend and find the settings you need to set up.single page:

    • Click on the left menu "Page Resources" -> "Page Management".
    • Find the target single page and click "Edit".
    • In the edit page, you will see a field named "Single page template" input box.
    • Enter the relative path and filename of the custom single-page template file you created. For example, if you createdpage/about-us.html, then fill inabout-us.html.
    • Save your changes.

After that, when accessing this single page, the system will use the one you specifiedabout-us.htmlorcontact-page.htmltemplate to display the content.

Tips for naming template files

The AnQi CMS also supports some default template naming conventions. If you create template files that comply with these conventions, you even do not need to specify them manually in the background, the system can automatically apply them:

  • Document default custom template:Name format is{模型table}/{文档ID}.html. For example, if your article model isarticle, there is an article with ID 10, you can createarticle/10.html.
  • Document list default custom template:Name format is{模型table}/list-{分类ID}.htmlFor example, if you have a category with ID 5, you can createarticle/list-5.html.
  • Default custom template for single page:Name format ispage/{单页面ID}.htmlFor example, a single page with ID 20 can be createdpage/20.html.

Although these default conventions are convenient, in actual use

Related articles

How to avoid content garbling caused by encoding problems in template files?

In the process of building and operating a website with AnQiCMS, we strive for smooth content display and ultimate user experience.However, the occasional problem of "content garbling" can often be like a stumbling block, making carefully arranged content look completely different, seriously affecting the professionalism of the website and the reading experience of users.This content is garbled, especially when it appears in template files, and it is often due to inconsistent file encoding.Understanding and solving this problem is crucial for the stable operation of the website.

2025-11-08

How to ensure that the website content is adaptively displayed on PC and mobile terminals?

In this era of widespread mobile device usage, ensuring that website content can adapt and display smoothly on devices of different screen sizes (whether it's a wide PC monitor or a small mobile screen) has become one of the key factors for website success.AnQiCMS provides powerful features to users, helping us easily achieve this goal.### 1. Understand AnQiCMS' adaptive display mode AnQiCMS understands the importance of multi-terminal access and therefore provided various website display modes from the beginning of the system design to meet different needs

2025-11-08

How to use AnQiCMS template syntax to display dynamic data?

AnQiCMS (AnQiCMS) is an efficient and flexible content management system, one of its core advantages lies in its ability to dynamically present background data on the website front end.Whether it is to display an article list, product details, or site configuration information, AnQiCMS provides an intuitive and powerful template syntax to help you achieve this goal.Understanding and mastering these template syntaxes is the key to creating highly customized websites.AnQiCMS's template engine adopts syntax similar to Django and Blade

2025-11-08

How to improve content display speed based on the high concurrency features of the Go language?

How AnQiCMS boosts the display speed of your website content with the high concurrency characteristics of the Go language?Now, website loading speed has become the golden standard for measuring user experience and search engine friendliness.In an era of information overload, visitors' patience is increasingly limited, any delay may lead to user loss.For content operators, how to ensure that content can be presented instantly has become an increasingly important issue.And AnQiCMS, relying on its unique Go language technology foundation, shows excellent advantages in content display speed. Then

2025-11-08

How to display the system configured name and Logo on the website homepage?

The website's name and logo are the foundation of the brand image, they can not only quickly convey the identity of the website, but also enhance the user's sense of trust and recognition.In AnQiCMS, presenting these important brand elements on the homepage is a direct and flexible task.AnQiCMS provides an intuitive backend setup and powerful template tag features, making this task very simple.### Backend Configuration: Unified Brand Information Management Firstly, all information that needs to be displayed on the website front end must be managed uniformly in the AnQiCMS backend

2025-11-08

How to display a company's contact information on the front-end page, including custom fields?

It is crucial to clearly and conveniently display a company's contact information in website operation.It not only enhances visitors' trust in the website, facilitates potential customers to consult, but is also the cornerstone of business transformation.AnQiCMS (AnQiCMS) understands this and provides powerful and flexible features that allow you to easily manage and display various corporate contact information on the website front end, including custom fields.

2025-11-08

How to dynamically set the page TDK information to optimize SEO display?

In today's digital age, Search Engine Optimization (SEO) is crucial for the success of any website, and the TDK information - that is, the page's Title (title), Description (description), and Keywords (keywords) - is a key factor for search engines to understand the content of the page and determine its ranking.If this information is set properly, it can not only improve the visibility of the website in search results, but also attract users to click and bring high-quality traffic. Manually setting TDK for each page is not only time-consuming and labor-intensive, but also prone to omission.Fortunately

2025-11-08

How to build and display multi-level navigation menus on a website?

The website navigation menu is a guidepost for users to browse the website content, a well-designed multi-level navigation system can significantly improve user experience, and help visitors quickly locate the required information.A clear, intuitive, and easy-to-use navigation is a key element for the success of a corporate website, product showcase page, or content portal.AnQi CMS is a comprehensive and flexible content management system that provides intuitive backend settings and powerful template tags, allowing you to easily build and manage multi-level navigation menus that meet various needs.

2025-11-08