The AnQi CMS, with its powerful flexibility and ease of use, has become a reliable assistant for many content operators.Especially in terms of content display, it provides us with a rich customization space.For those pages on the website that require unique layouts or specific features, such as "About Us", "Contact Us", or a special event landing page, we often hope that they can have a visual style that is entirely different from that of ordinary articles or list pages.The company CMS provides a very convenient way for us to set exclusive custom templates for these single-page applications, so that every corner of the website can meet our personalized needs.Today, let's take a detailed look at how to implement custom template settings and display for a single page in the Anqi CMS.

1. Understanding the single page and template mechanism of Anqi CMS

Firstly, we need to have a clear understanding of the 'single page' in the Anqi CMS.By definition, a single-page refers to those pages that are independent in content, not dependent on categories or specific content models, and are usually presented in the form of a single article.They are commonly used to display company profiles, service introductions, privacy policies, or as specific marketing activity pages.In the AnQi CMS, these pages are created and edited through the "Page Resources" module under "Page Management

The template mechanism follows. The Anqi CMS adopts a template engine syntax similar to Django, making our template creation and maintenance very intuitive. All template files are in.htmlEnglish suffix, and uniformly stored in the root directory of the site/templatefolder. For easy management, each template theme will have its own independent directory, such asdefault.

For a single page, the system itself provides some default template rules. For example,page/detail.htmlIt is usually a general single-page detail template. Further more, you can also create a single page for a specific ID.page/detail-{单页ID}.htmlsuch a template.But the strength of Butan CMS lies in its ability to allow us to define template filenames more freely.page/about-us.htmlCreate a dedicated template to achieve highly personalized display.

Secondly, set up a custom template for a single page in the background.

The process of setting a custom template for a single page is very direct, mainly completed in the background management interface of Anqi CMS.

  1. Enter Page Management:Log in to the CMS backend, find the "Page ResourcesHere, you can choose to create a new single-page or edit an existing single-page.
  2. Locate the "Single Page Template" field:After entering the editing interface of a single page, you will see a series of fields for filling in page information, among which there is an option named 'Single Page Template'.This field is the key to specifying our custom template file.
  3. Enter a custom template filename:In the "Single Page Template" field, you need to enter the name of the template file you have prepared for this single page. For example, if you want to design a very special layout for the "About Us" page, you can prepare a file namedabout-us.htmlThis file, so here, you just fill in.about-us.htmlThe system will look for and apply the corresponding template in the folder of the template theme you are currently using according to the filename you enter.

Here it is particularly emphasized that the filename you fill in here must be completely consistent with the template filename you actually create on the front-end, including the suffix,.html)and case sensitivity.If the system cannot find the corresponding template file, this single-page may display an error (such as an empty page) or fall back to a certain default display method of the system, which may affect the user experience.

Three, build the front-end custom template file

The template file name is set up on the back-end, and the next step is to create and write this custom template file.

  1. Confirm the location of the template file:Firstly, you need to go to the root directory of your security CMS site, find/templatefolder, then enter the theme directory you are currently using (for exampledefault)。To maintain good file organization structure and facilitate management, it is usually recommended to store the custom template files for a single page in the theme directory.page/In the subdirectory. Therefore, based on the settings of the background, you may need to create similar/template/default/page/about-us.htmlSuch a file.
  2. Write template content:Open the one you created.htmlFile, you can start writing your page layout and content. The template engine of Anqi CMS supports rich syntax, allowing you