How to find and edit the template folder being used by the current site in AnQiCMS?

Calendar 👁️ 65

As an experienced website operation expert, I know that mastering the positioning and editing methods of templates in a flexible and efficient content management system like AnQiCMS is a key step in achieving website personalization, improving user experience, and optimizing SEO.AnQiCMS with its lightweight and high-performance Go language provides us with a solid foundation, and its powerful template customization capabilities give content operators unlimited possibilities.

Today, let's delve into how to accurately find and edit the template folder used by the current site in AnQiCMS.This might sound a bit technical, but don't worry, I will guide you step by step in the most easily understandable way.

Template, the soul and facade of the website

Before starting the specific operation, let's first understand the role of the template in AnQiCMS and all websites.Templates are not just the 'skin' of a website; they are also the carrier of the brand image, the cornerstone of user experience, and an important part of search engine optimization.By fine-tuning the template, we can ensure that the visual style of the website is highly consistent with the brand tone, provide smooth user interaction, and offer a friendly content structure for search engines, thereby effectively enhancing the competitiveness of the website.The Django template engine syntax provided by AnQiCMS allows even non-professional developers to relatively easily learn and modify, achieving personalized content display.

Locate the template folder of the current site

AnQiCMS has a clear logic in managing templates. All template files are uniformly stored in the root directory under its installation path/templateIn this directory, there may be multiple template folders, each representing a set of independent templates. So, how do we know which one is currently being used by the site?

The answer is in a key file inside each template folder:config.json.

  1. Global template directory:/templateFirst, you need to find the installation path of AnQiCMS. In this path, you will see a file namedtemplateThe folder. All the templates available on your site, including the ones built-in and those you may upload or develop later, will be stored in this directory, with each template in its own independent folder.

  2. Identify the activation template:config.jsonofstatus: 1Enter/templateAfter the folder, you will see some subfolders, such asdefault/mobilewait, or you can customize the template name. To determine which template is currently being used, you need to enter each subfolder, find and open the file namedconfig.json.

    in thisconfig.jsonIn the file, there are two fields that are particularly important:

    • "package": "模板文件夹名称"This field defines the name of the template folder, which is usually consistent with the name of the folder it is in.
    • "status": 1This is the key! When a template folder containsconfig.jsonin the filestatusthe field is set to1it means that the template is the currently active template being used on the site. Other templates'statusvalues are usually0.

    Therefore, by viewing the contents of each template folderconfig.jsonyou can quickly find the template folder currently in use on the site. For example, if/template/my_custom_theme/config.jsonin"status": 1thenmy_custom_themeit is the folder you are looking for.

Two main ways to edit template files

Found the template folder, the next step is to edit. AnQiCMS provides two main methods to modify template files to meet the needs and habits of different users.

Method 1: Modify directly through the file system (recommended for users with server operation experience)

This is the most direct and common way. It is very efficient for users with experience in operating FTP/SFTP or server file managers (such as Baota panel, 1Panel, etc.)

  1. Connect to the server:Use an FTP/SFTP client (such as FileZilla) or log in to your server through your server management panel (such as Baota Panel, 1Panel).
  2. Navigate to the template directory:Find your AnQiCMS installation path and enter it/template/您识别出的当前模板文件夹.
  3. Start editing:
    • Public section: bash.htmlIt usually contains header, footer, and other common code referenced by each page.
    • code snippet: partial/The directory contains reusable code snippets such as sidebars, breadcrumbs, etc.
    • Core pages:Like the homepageindex/index.html, article detail page{模型table}/detail.html, list page{模型table}/list.htmlThese, are all the files you may need to pay attention to.
    • Mobile Template:If your site has enabled the independent template mode for mobile devices, then you will also see one in the current template folder.mobile/Subdirectory, containing corresponding mobile template files.
    • Syntax points:AnQiCMS uses a template engine syntax similar to Django. Variables are enclosed in double curly braces.{{变量名称}}Output, while conditional judgment, loop control, and other logic are used{% 标签 %}and{% end标签 %}Appear in pairs. When performing text editing, be sure to ensure that the template file is uniformly adoptedUTF-8 encodingOtherwise, it may cause page garbling.
  4. Save and Upload:After modification, save the file and upload it to the server via FTP/SFTP or other methods to overwrite the original file.

Important reminder:Before modifying any template files, please make sure toa full backupto the local or another secure location. Incorrect modifications may cause the website to display errors or become inaccessible.

Method two: Through AnQiCMS background online template editing (suitable for quick adjustments or users unfamiliar with the server)

Since the AnQiCMS v2.1.0 version, the system has added the function of editing background templates, which provides great convenience for content operators.

  1. Log in to the AnQiCMS backend:Log in to the AnQiCMS management interface using your admin account.
  2. Navigate to template design:Find and click in the left navigation bar模板设计and then select网站模板管理.
  3. Select and edit:Here, you will see the list of templates you are currently using.Click the edit button next to the corresponding template to directly modify the template file in the browser.The background editor usually provides features such as syntax highlighting and other auxiliary functions to help you edit code more efficiently.
  4. Save changes:After modification, click the save button. The system will automatically update the template file on the server.

Advantage:This method does not require leaving the browser, it is convenient, especially suitable for making some small-scale style or text adjustments.Note:Even though the background editing feature is very convenient, it is still strongly recommended to back up locally and verify the effect of the modifications in the test environment before making large-scale changes to the core template files, in order to avoid affecting the stability of the online website.

**Practice and Suggestions

  • Develop the habit of backing up:Emphasizing a hundred times is not too much, please back up before each template modification! This will allow you to recover quickly in case of any unexpected events.
  • Understand template tags:AnQiCMS provides a rich set of template tags (such assystem/contact/archiveListThey are the bridge between you and the website data. Take the time to read the official documentation about template tags (such as those in the documentation of thedesign-tag.md), which will greatly enhance your ability to customize templates.
  • Start modifying from the copy:If you plan to make extensive customizations to the template, consider copying the current active template folder and itsconfig.jsonofstatusis set to0,packageChange to a new name. Activate the new template in the test environment and make modifications on the new template. This can prevent direct damage to the online environment.
  • Use the development tools: Browser developer tools (F12) are your good helper for debugging front-end styles and finding elements.
  • Test, test, and test again: Any modification, no matter how small, should be tested on different browsers and devices (PC, mobile, tablet) to ensure that the display and functionality are normal.

You have mastered the skills of locating and editing the AnQiCMS template folder, and you have the powerful ability to control the appearance and function of the website.Hope this guide can help you better utilize AnQiCMS to create a unique, high-efficiency website!


Frequently Asked Questions (FAQ)

Q1: How do I update the front-end website content immediately after modifying the template file?A1: AnQiCMS usually caches page content to improve access speed.After you modify the template file, you may need to clear the system cache to see the latest changes.You can log in to the AnQiCMS backend, find and click the "Update Cache" feature in the left navigation bar, and perform the clear operation.If it still does not work, try clearing the browser cache or accessing in incognito mode.

Q2: Can I create my own new template? What should I pay attention to?A2: Of course! AnQiCMS highly supports custom templates. You just need to create/templatea new folder under the directory (for examplemy_new_theme), and create aconfig.jsonFile, fill in the template information according to the documentdesign-director.mdin the format (for example, "name": "My new template"

Related articles

Where should the static resources such as CSS, JS, and images used by the website front-end be placed?

As an experienced website operations expert, I am well aware that the reasonable management of website front-end static resources is crucial for website performance, maintenance convenience, and even search engine optimization (SEO).AnQiCMS (AnQiCMS) took this into full consideration from the very beginning of the system design, providing developers and operators with a clear and efficient path for resource management.Today, let's delve into the discussion of where to place the CSS, JS, and image static resources used on your website's front end in AnQiCMS, in order to achieve the most reasonable and efficient practice.

2025-11-06

Where is the default directory for storing AnQiCMS template files?

## Unveiling the Location of AnQiCMS Template Files: Default Directory Depth Analysis When building and operating a website with AnQiCMS, template files are the core that determines the appearance and interaction of the website.Whether it is to carry out personalized customization, fault diagnosis, or secondary development, clearly understanding the storage location of the template files is the first step.Where is the default template file stored for AnQiCMS?The answer is the `/template` directory. ###

2025-11-06

How to quickly view the root directory path of the current AnQiCMS installation?

As an experienced website operations expert, I am well aware that clearly understanding the file structure and critical path of AnQiCMS website is of great importance when managing and maintaining it.Especially when adjusting configurations, modifying templates, troubleshooting, or managing multiple sites, quickly locating the root directory path of AnQiCMS can greatly enhance our work efficiency.AnQiCMS is a modern content management system developed based on the Go language, with flexible and diverse deployment methods, ranging from running directly on the server to managing through panels such as Baota, 1Panel, and containerized deployment

2025-11-06

Does the `exists -eq 0` check in the AnQiCMS `start.sh` script cause a race condition in extreme high concurrency startup scenarios?

As an experienced website operations expert, I deeply understand AnQiCMS' excellent performance in providing efficient content management solutions for small and medium-sized enterprises and self-media operators.It gained widespread praise for its high performance and many practical features brought by the Go language.However, even the most excellent system, its deployment and operation details are worth in-depth discussion.

2025-11-06

Under the multi-site management mode, how are the cache and independent directories of each site named?

As an experienced website operations expert, I have accumulated rich experience in managing and optimizing various websites, especially with a deep understanding of AnQiCMS (AnQiCMS) as an efficient and stable content management system.Multi-site management is a powerful feature of AnQiCMS, allowing users to easily operate multiple independent websites under a single system.However, under such a model, many operators may be curious: How is the cache and data directory of each site independently managed by the system, and how are they named?Today, let's delve deeply into this issue.

2025-11-06

What is the usual access path (URL) for the AnQiCMS backend? Can it be customized?

As an experienced website operations expert, I am well aware of the importance of the security and convenience of the background management entry for website operations.Understanding the backend access path settings and customization capabilities of AnQiCMS, an efficient and secure content management system, is an indispensable part of our daily work.Today, let us delve into the mysteries of the AnQiCMS backend access path together.

2025-11-06

Where is the default storage location for the executable files of the AnQiCMS project?

AnQi CMS is an efficient and customizable enterprise-level content management system, with its core being a lightweight and powerful executable file.For any website operator, it is crucial to know the location of this 'heart', as it not only concerns daily maintenance and management, but also affects the stable operation and fault troubleshooting of the system.Where is the executable file of the project carrying all the functions of AnQi CMS usually stored?Let's uncover this mystery.

2025-11-06

What are the recommended naming rules for the template file when customizing the document template?

AnQi CMS is an enterprise-level content management system developed with Go language as the core, which provides efficient and stable content management services while also giving users high levels of customization, especially in template design.When we want a web page to have a unique and stylish design, a custom document template becomes an indispensable tool.However, how to name these template files in a standardized manner so that the system can be more intelligent and efficient in identifying and applying them is a concern for many operators.Today, let's delve into the recommended naming rules of Anqi CMS when customizing document templates

2025-11-06