How to flexibly specify independent display templates for single-page content?

Calendar 👁️ 65

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.

Related articles

How to use custom templates to display content for specific documents or categories?

In the daily operation of websites, the flexibility of content display is often the key to whether a website can stand out and meet the diverse needs of users.AnQiCMS (AnQiCMS) fully understands this point and provides powerful custom template features, allowing content to not only be efficiently managed but also presented in a way that conforms to brand characteristics and user habits. ## Unlock the Custom Template Ability of AnQi CMS AnQi CMS, as an enterprise-level content management system, has always focused on the customization needs of content display from the very beginning.

2025-11-08

How to design and deploy a template independently for mobile website?

With the popularity of smartphones, the user experience of mobile websites has become a key factor in determining the success of a website.A well-designed mobile website can not only effectively enhance customer satisfaction, but is also crucial for search engine optimization (SEO).AnQiCMS fully considers this requirement, providing flexible and diverse mobile template solutions, especially supporting independent design and deployment of mobile template, so that your website can show its posture on different devices.### Get to know AnQiCMS's mobile template strategy In AnQiCMS

2025-11-08

What kinds of responsive or adaptive template display modes does AnQiCMS support?

In today's mobile internet age, the user experience of websites is no longer limited to computer screens.Whether it is a smartphone, tablet, or various sizes of displays, the website must be presented in **status**.AnQiCMS understands this and therefore offers a variety of display options in the template to ensure your content reaches every visitor seamlessly. ### One, Adaptive Template Mode (Responsive) Let's talk about the most common "adaptive template" mode first.The core of this pattern lies in 'adaptability', which allows the website to 'change with no change'

2025-11-08

How to ensure that the encoding of the template file is correct and avoid garbled characters on the front-end page?

The website front-end page displaying garbled characters is undoubtedly one of the most headache-inducing problems.When visiting a website, the originally clear and readable text turns into a pile of undecipherable symbols, which not only severely affects the user experience but also makes the website look unprofessional.For friends using AnQiCMS to build and manage websites, ensuring the correctness of the template file encoding is a key step to avoid such issues.

2025-11-08

How to implement the reuse of the common part of AnQiCMS templates (such as headers and footers)?

In AnQiCMS, efficient website content management is inseparable from a flexible and easy-to-maintain template system.You may encounter such a need when creating a template: headers, footers, navigation bars, and other common elements need to appear on every page of the website.If repeating the same code on each page is not only time-consuming and labor-intensive, but also modifying it in the future will cause a domino effect.Luckyly, AnQiCMS leverages the powerful functions of the Django template engine to provide an elegant solution, allowing these common parts to be easily reused.### Core Foundation

2025-11-08

How to use the `system` tag to display the website name and logo on the page?

## Easily Solved: How to Gracefully Display Your Website Name and Logo on AnQiCMS Page It is crucial to display brand identity when operating a website.The website name and logo are not only the key elements for visitors to identify your brand, but also the foundation for enhancing the professionalism and trust of the website.AnQiCMS provides a直观而强大的template tag system that allows you to easily call and display these core information on any page of the website.Among them, the `system` tag is specifically designed to obtain this type of global site configuration. Next

2025-11-08

How to dynamically display the website filing number and copyright information through the `system` tag in the footer?

When operating a website, the filing number and copyright information are an indispensable part of the website. They are not only the symbol of the legitimate operation of the website but also reflect the respect for original content.For AnQiCMS users, managing this information and displaying it dynamically through the footer is a convenient and efficient operation.AnQiCMS provides an intuitive backend setting and flexible template tags, allowing you to easily meet this requirement, saving the trouble of manually modifying the code on each page.

2025-11-08

How to conveniently display the company's contact phone number and address with the `contact` tag?

In website operation, clearly and conveniently displaying the company's contact information is a key link to enhance user trust and promote business communication.Whether it is to seek cooperation, provide customer support, or simply to let visitors understand the location of the company, contact information plays a vital role.AnQiCMS fully understands this and provides us with an extremely convenient way to manage and display this information through its powerful template tag system.

2025-11-08