As a senior CMS website operation person, I know the exquisite presentation of content lies in the flexible use of templates.AnQiCMS as an efficient and customizable content management system provides us with powerful tools to shape every detail of the website, including the layout and style of single-page detail pages.Understanding the template naming rules is the basis for our efficient management and optimization of website content.

Understand the organization structure of template files

AnQiCMS template files are stored in the project's/template/public/static/In the catalog.

Universal default template for single page detail page

For most single-page applications in Anqi CMS, the system will attempt to render a generic template. In usingFolder organization modethe template package, this generic default template is usually namedpage/detail.html.When the system is processing any single page detail page, it will first look for this file.If the file exists and no more specific template is specified, then all pages not configured specifically will be uniformly displayed using this template.This provides a convenient way to establish a unified design tone and layout framework for all single pages of the website.

The naming rule of a specific single-page template based on ID

In some cases, we may need to design a unique display effect for a specific single page on the website.AnQiCMS fully considered this personalized need, allowing us to create highly customized templates for individual single pages.Folder organization modeBelow, we can name the template file by the page ID, formatted aspage/detail-{单页ID}.htmlFor example, if a single-page ID is 10, then its dedicated template can be namedpage/detail-10.htmlWhen the system detects such a template, it will take precedence over the generalpage/detail.htmlLoaded and applied.

Moreover, the document also mentions another custom naming format for specific IDs:page/{单页面id}.html. This provides a more direct and concise naming method, for example,page/10.htmlits function is withpage/detail-{单页ID}.htmlSimilar, it is all for the precise template control of a specific single page.This flexibility ensures that even the same page type can have a unique visual presentation according to content or business needs.

naming differences under the flattened file organization mode

if your AnQiCMS template usesFlat file organization modeThe default naming rule of the single-page detail page template will be adjusted accordingly to adapt to this structure. In this mode, the general default template file for a single page will bepage.html. And for a single page with a specific ID, the template file should be namedpage-{单页ID}.html. Although the file path structure is different, the core logic of finding and applying templates and the priority strategy behind it remain consistent with the folder organization mode.

Flexible application of custom templates and backend configuration

In addition to the default and ID-based naming rules set by the system, AnQiCMS also gives us great freedom, allowing us to fully customize the filename of single-page templates. For example, if you want to create a unique template for the single-page named "Contact Us", you can name itcontact.htmlAnd place it inpage/Under the directory (i.e.),your_template_name/page/contact.html)

To enable this custom template, you need to make simple configurations in the AnQiCMS backend: log in to the backend, navigate to 'Page Resources' under 'Page Management'.Edit the corresponding "Contact Uscontact.htmlAfter saving the changes, the system will load and use the one you explicitly specify when rendering the "Contact Us" page.page/contact.htmlTemplates, thus achieving highly personalized content display. This mechanism is particularly suitable for those who have unique requirements for page layout and content and do not want to follow the universal default templates.

The encoding and storage location requirements of the template file

page/For example, in the folderyour_template_name/page/),or directly placed at the root directory of the flattened file organization mode.Only in this way, the AnQiCMS template engine can correctly identify, locate, and load these template files to complete the page rendering work.

Mastering the template naming rules of AnQiCMS single page detail pages is a key link in the efficient management and optimization of content by website operators.It not only ensures the correct presentation of page content, but also gives you the ability to flexibly adjust the page layout and style according to business needs, thereby providing users with a better and more personalized browsing experience.By reasonably applying these rules, you can maximize the advantages of AnQiCMS in content management.


Frequently Asked Questions (FAQ)

Q1: If I created a single page forpage/detail-{单页ID}.htmlorpage/{单页ID}.htmlBut also specified a custom template filename in the background, which one will the system prioritize?

A: The system will follow a clear priority order when processing a single page.It will prioritize using the "single page template" filename you explicitly set for this single page in the "Page Management" section of the AnQiCMS backend.page/detail-{单页ID}.htmlorpage/{单页ID}.htmlSearch for them. If the templates with these specific IDs are also not found, the system will eventually revert to the generalpage/detail.html(or in the case of flat mode'spage.html) as the default template.

Q2: Can I place the single-page template file in/template/{我的模板}/another_folder/such a custom subdirectory?

A: Cannot. To ensure that the AnQiCMS template engine can correctly identify and load, the single-page template files must be strictly placed in the template package you are currently using.page/For example, in the folderyour_template_name/page/), or directly placed in the root directory of the flattened file organization mode.Placing them in any other custom folder will cause the system to be unable to find and apply these templates.Adhering to this agreement is an important prerequisite for the normal operation of the template.

Q3: How can I specify a custom template file for a specific single page in the AnQiCMS backend?

A: Log in to the AnQiCMS admin interface and then navigate to the 'Page Resources' menu under the 'Page Management' option.Find and click to edit the single page entry you want to apply the custom template to.In the pop-up edit page form, you will see a field named "Single Page Template".your_template_name/page/about.html, you just need to fill inabout.html)。Complete the filling and click Save Changes. The system will then proceed in