AnQi CMS provides a flexible and powerful template customization mechanism, allowing you to create a unique and stylish website according to your actual needs.Whether you want to adjust the overall layout or showcase personalized design for specific content, Anqi CMS can provide clear paths and a rich set of tools to support your creativity.
One of the core advantages of Anqi CMS is its template engine.It uses a syntax similar to Django and Blade, which allows those familiar with web development to quickly get started.{{变量}}Output data, through{% 控制语句 %}To perform conditional judgment or loop, it greatly simplifies the template writing process.It is also worth mentioning that Anqi CMS supports three website modes: adaptive, code adaptation, and independent sites for PC and mobile, which means you can customize the display method that is most suitable for your audience.
Template file organization and structure
All template files in the AnQi CMS are stored in the root directory./templateIn the folder. Each independent template design will have its own dedicated directory, and there will be a file contained in that directory.config.jsonFile, used to define the name, version, author, and other basic information of the template. The static resources required by the template, such as CSS, JavaScript scripts (JS), images, etc., are stored uniformly./public/static/[en] Catalog, this clear separation of responsibilities is helpful for project management and maintenance.
On the organization of template files, Anqi CMS provides two main modes: folder organization mode and flattened organization mode. Regardless of which one is chosen, there are some default naming conventions, such as:
- Home PageIt is usually
index/index.htmlorindex.html. - Document details pageIt can be
{模型table}/detail.htmlwhere,{模型table}Represents the content model you create in the background (such asarticleArticle model). - Document List PageIt can be
{模型table}/list.html. - Single Page Detail PageIt is usually
page/detail.html. - In addition, there are also templates for such pages as
errors/404.html/errors/500.htmland error pages.
Follow these naming conventions, the system will automatically apply these templates when identifying the corresponding page. This predefined structure greatly reduces the hassle of manually selecting a template each time a new page is created.
Deep into template customization at content level
The template customization capability of Anqi CMS is not limited to the common layout of websites; it also delves into all levels of content management.
Content model and custom fields:AnQi CMS supports a flexible content model, which means you can create different types of content (such as articles, products, events, etc.) according to your business needs and define unique custom fields for each type.These custom fields (such as product parameters, article authors, etc.) can be easily called through specific tags in the template, thereby achieving highly personalized content display.
Categories, documents, and personalized templates for single pages:This is a very practical feature. Suppose you have a special 'About Us' single-page, which needs a layout completely different from other pages, you can create a file namedpage/about.htmlThe file, then edit the "About Us" page in the "Page Management" section of the backend management interface, and specify the "Single Page Template" field asabout.htmldetail.htmlor specify for a particular product detail pageproduct-showcase.htmlThis level of granularity customization enables endless possibilities for the display format of content.
Flexible control in the template: tags and filters
The template engine of Anqi CMS is built-in with rich tags and filters, which are the cornerstone for building dynamic content.
- System tags (
system/contact/tdk)Enable you to easily obtain the website name, contact information, SEO information, and other global configurations. - Navigation label (
navList/breadcrumb)Help you build dynamic menus and breadcrumb navigation. - Content label (
archiveList/archiveDetail/pageDetail/categoryDetail)It is responsible for retrieving and displaying core content such as articles, products, single pages, categories, etc. from the database. - Logical control tag (
if/for)Provided the ability to make conditional judgments and loop traversal, allowing the template to dynamically generate content based on data. - Auxiliary tags (
include/extends/macro)Supports modular development with templates. You can extract common parts such as headers and footers into independent files and reference them where needed, greatly improving the reusability and maintenance efficiency of templates. - Filter{
date/truncatechars/safe})Then you can perform operations such as formatting, truncating, and secure processing on variables to ensure that data is presented in**format.
Through the combination of these tags and filters, you can implement highly complex business logic and data display in the template.
Achieve responsive and multi-platform adaptation
For different device screens, Safe CMS provides various adaptation solutions. You can choose:
- Adaptive mode:Write a template that adjusts the layout of the website automatically on different devices using technologies like CSS media queries.
- Code adaptation mode:Templates are designed for both PC and mobile end, and the system will automatically switch according to the visited device.
- Independent site mode for PC + mobile end:This is a more thorough separation, where you can set up a separate domain for the mobile site (such as m.example.com) and create a template root directory.
mobileA subdirectory containing exclusive template files for mobile devices, enabling independent management and display of PC and mobile content.
In summary, Anqi CMS has provided users with great flexibility in website template customization.From selecting the overall framework to the fine adjustment of specific content blocks, and to the flexible display of dynamic data, every step has clear and powerful function support.By familiarizing yourself with its template syntax and file organization conventions, combined with the backend content management features, you can easily bring your design ideas to life, creating a website that is both beautiful and practical.
Common Questions (FAQ)
Ask: Where should I start if I want to design a brand new website theme from scratch?You can start by creating
/templatea new folder under the directory, for examplemytheme, and createconfig.jsonFile, basic information for defining a new topic. Next, you need to base on the core pages of the website (such as the homepageindex.html, document detail pagearticle/detail.html, list pagearticle/list.htmlCreate the corresponding HTML template file and reference the resources such as CSS and JS placed in/public/static/mythemethe following location.Question: Can I apply a unique template to a single specific article or page, instead of having it follow the default template of its category?Of course, you can.In the background management interface, 'Document Management', 'Page Management', or 'Category Management', edit the content items you want to personalize for display.
special-article.htmlorabout-us-page.html),The system will prioritize the template you specify.**Question: After uploading a new template file, the website front