AnQiCMS (AnQiCMS) offers 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, distinctly different from pages like "Contact Us" or "Terms of Service", without modifying the overall template structure of the website.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 marketing landing page, or a legal statement that must strictly adhere to specific layout specifications.If all single pages use a unified template, it is difficult to meet these personalized needs.AnQi CMS is well-versed in this, and through its flexible template mechanism, you can easily break through this 'one-size-fits-all' restriction.

How to flexibly specify an independent display template for a single page?

In Anqi CMS, to implement independent template display for single-page content, it mainly involves two core steps: creating your exclusive template file, and associating this template file in the background to the single page you want.

Step 1: Create your exclusive template file

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

Anqi CMS provides a default template naming convention for single pages:page/detail.htmlThis means that if you do not make any special settings, all single pages will use this file to render.If you want a single page to have a unique style, you can create a custom template in one of the following two common ways:

  1. Specify based on the single page ID:You can create a name calledpage/{单页面ID}.htmltemplate file. For example, if your 'About Us' page ID in the backend is 10, then you can createpage/10.htmlFile. When the user accesses this single-page with ID 10, the system will prioritize usingpage/10.htmlto render.
  2. Specify a custom name using: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 function of the page.For example, create a named for the "About Us" pagepage/about.htmlfile, or create a download protocol for apage/download.htmlFiles. This method has the advantage that the template name is intuitive and easy to understand, convenient for management and search.

No matter which naming method you choose, please make sure that the suffix of your template file is.htmlAnd the content should be encoded in UTF-8 to avoid garbled characters. Place these custom template files in the template theme folder you are currently using.page/In the subdirectory, this is a good habit, which helps maintain the neat structure of the template files.

Step two: 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 editing 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 the first step. For example, if you createdpage/about.html, then enter it herepage/about.html. If you just createddownload.htmland placed intemplate/default/directory (not instead ofpage/subdirectory), then fill in directlydownload.htmlJust do it.Make sure the file name you enter matches the actual template file name exactly, including case and suffix.
  6. Save your single page settings.

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

In this way, Anqi CMS decouples content management and 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 presentation and operational efficiency of the website.


Frequently Asked Questions (FAQ)

Q1: How can I restore the 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.html), just edit the single page in the background, clear the content of the "Single Page Template" input box, and then save. The system will automatically revert to the default settings.

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

Q3: What will happen if the custom template file I specify does not exist?A3: If you specify a non-existent template file in the background, when accessing the single page, the Anqicms 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.