AnQiCMS provides excellent flexibility in website content management, especially in the display of single-page content, allowing us to specify completely independent display templates for different single pages.This means that your "About Us" page can have a unique layout and design, distinct from pages like "Contact Us" or "Terms of Service", without modifying the overall structure of the website template.This fine-grained control brings great freedom to the presentation of website content.

Many times, certain pages on our website carry important functions such as brand image display, user guidance, or information disclosure.For example, a specially designed landing page for marketing, or a legal statement that must strictly adhere to specific layout standards.If all single pages use a unified template, it is difficult to meet these personalized needs.AQS CMS is well-versed in this, allowing you to easily break through the restrictions of this 'one-size-fits-all' approach with its flexible template mechanism.

How to independently specify a display template for a single-page?

In AnQi CMS, the independent template display of single-page content is mainly divided into two core steps: creating your exclusive template file, and associating this template file with the single page you want to use in the background.

First step: Create your exclusive template file

Firstly, you need to enter the template root directory of Anqi CMS. Usually, all template files are stored in/templateIn the directory, and organize your specific template topics within separate folders (for example,/template/default/In this theme folder, you can create one or more independent template files for a single page.

Anqi CMS provides a default naming convention for templates for single pages:page/detail.html.This means that, if you do not make any special settings, all single pages will use this file to render.

  1. According to the single page ID specified:You can create a name forpage/{单页面ID}.htmltemplate file. For example, if your "About Us" page has an ID of 10 in the backend, then you can createpage/10.htmlFile. When the user accesses the single page with this ID of 10, the system will prioritize usingpage/10.htmlto render.
  2. Specify using a custom name:This is a more commonly used and more readable way.You can name the template file with a meaningful name based on the content or functionality of the page.page/about.htmlfile, or create a download protocol forpage/download.htmlThe file. This method has the advantage of intuitive and easy-to-understand template names, which is convenient for management and search.

Make sure that the file extension of your template is.htmland the content is encoded in UTF-8 to avoid garbled characters. Place these custom template files in the folder of the current template theme you are using.page/In the subdirectory, this is a good habit, which helps to keep the structure of the template files neat.

Step 2: Associate the single page with the template in the background

After the custom template file is created, the next step is to inform the Anqi CMS which single page should use which custom template.

  1. Log in to your Anqi CMS backend management interface.
  2. Navigate to the 'Page Resources' menu and then click 'Page Management'.
  3. Find the single page where you want to apply a custom template, and click the 'Edit' button on the right.
  4. In the single-page edit page, scroll down to find the 'Other Parameters' section. Here, you will see an input box named 'Single Page Template'.
  5. Enter the name of the custom template file you created in step one in this input box. For example, if you createdpage/about.html, then fill in herepage/about.html. If you only createddownload.htmland placed intemplate/default/the directory (instead ofpage/a subdirectory), then fill indownload.html.Please make sure that the file name you enter matches the actual template file name exactly, including case and extension.
  6. Save your single page settings.

After completing these steps, when the user visits the single page you just modified, Anqi CMS will automatically render it using the custom template you specified. In the custom template file, you can use the features provided by Anqi CMS.{% pageDetail %}Use tags to obtain the title, content, images, and other data of a single page, thereby realizing the display of dynamic content.

Through this method, the Safe CMS decouples content management from page design, allowing you to assign exclusive appearance and functionality to each unique single page content without touching the core code, greatly enhancing the visual expression and operational efficiency of the website.


Common Questions (FAQ)

Q1: How can I restore a single page to the default template?A1: If you want to stop using a custom template for a single page and revert to the website's default single page template (usuallypage/detail.htmlJust clear the content in the 'Single Page Template' input box when editing the single page in the background, and then save. The system will automatically revert to the default settings.

Q2: Can I specify the same custom template for multiple different single-page applications?Of course, you can.If you have multiple single-page websites that you want to share the same special layout or design, for example, several marketing landing pages all use a similar layout structure, then you can create a custom template and then specify the name of this template for all the single pages that need to apply it.This helps improve the reusability of templates and reduce repetitive work.

Q3: What will happen if the specified custom template file does not exist?A3: If you specify a non-existent template file in the background, when accessing the single page, the Safe CMS will usually report an error, causing the page to fail to display normally.Therefore, before specifying the template name in the background, be sure to confirm that the corresponding template file has been uploaded and placed in your template theme folder.