How to customize AnQiCMS template and implement personalized content display layout?

Calendar 👁️ 64

AnQiCMS provides highly flexible template customization capabilities, helping us not only to build functionally complete websites but also to achieve unique personalized content display layouts.This flexibility is one of the core advantages of AnQiCMS, especially for small and medium-sized enterprises or content operation teams that pursue brand uniqueness and user experience. Understanding template customization is the key to unleashing its full potential.

The first step: Understand the basic of AnQiCMS template system

AnQiCMS adopts a syntax similar to the Django template engine, making it very easy for users familiar with web development to get started. Its template files are written in.htmlWith the suffix, they are stored uniformly in the system's/templateIn the root directory. Static resources such as styles, JavaScript scripts, images, and so on related to the template will be placed separately in/public/static/In the catalog.

Each template has an 'ID card' -config.jsonThe file includes the name, version, author, description, and an important setting itemtemplate_typeThis defines the template adaptation type, such as adaptive, code adaptation, or PC+mobile independent mode. This allows us to have a clear direction when choosing and developing templates.

On file organization, AnQiCMS supports two modes: folder organization mode and flattened file organization mode. Whichever one is chosen, there are conventional file naming rules, such as the home page is usuallyindex.htmlorindex/index.htmlThe document detail page can be{模型table}/detail.htmlThe category list page is{模型table}/list.htmlEtc. Understanding these conventions allows us to quickly locate and modify the target page.

Step two: Master the template file type and custom path for fine-grained control

AnQiCMS in the customization of content display layout largely benefits from its ability to specify independent templates for different content types.This goes beyond simple global styles, allowing us to design unique visual presentations for each element on the website - whether it's articles, product categories, or independent single pages.

For example, if our website has a single page named "About Us", we want it to have a layout and design that is completely different from other pages, we can create a page namedpage/about.htmlThe template file. Then, when editing the single page 'About Us' in the background, specify the template asabout.htmlThus, when the user visits the "About Us" page, the system will load this exclusive template to achieve a completely personalized display.

Similarly, for a specific document category or a specific document detail, we can also present them with a unique layout by specifying a custom template in the background.This means that we can design a concise and clear list style for news information, and design a card layout with pictures and texts for product display, and all of this can be done without changing the universal template of the entire website.

AnQiCMS has specially considered the needs of mobile terminals. If our template is code adaptation or PC+mobile terminal independent mode, a can be created in the root directory of the templatemobile/Directory. In this directory, we can replicate the same template structure for mobile as that for desktop, and optimize and modify it for targeted optimization, ensuring that the user experience is **on different devices.

Step 3: Use template tags to dynamically display content and give the layout vitality

The template file is just the "skeleton" of the layout, what truly brings the content to life and makes it vibrant is the rich template tags and filters of AnQiCMS.They play the role of 'data connectors' and 'content processing tools', dynamically presenting the data managed by the back-end on the front-end.

The core syntax rules are very intuitive: use double braces{{ 变量 }}To output data, use single braces and percent signs{% 标签 %}Call a function or control logic.

  1. Get basic information of the website: {% system %}Tags can help us easily get the website name, logo, filing number, copyright information, and other global settings;{% contact %}It is used to obtain contact information, such as phone, address, email, etc., even including the contact information fields customized in the background. These are frequent guests in the common areas of the website header and footer.

  2. Build navigation and page structure: {% navList %}Tags are very powerful, able to generate multi-level navigation menus, combinedifTags, we can easily implement complex dropdown menus or sidebar navigation layouts.{% breadcrumb %}It can automatically generate breadcrumb navigation that conforms to SEO standards, improving user experience.

  3. Core content display:

    • List display:{% archiveList %}and{% categoryList %}It is the most commonly used tag, used to display article lists, product lists, or category lists.They support filtering content by category ID, model ID, recommendation attributes (such as headlines, recommendations), and sorting methods (latest, hottest) and more. CombinedforLoop tags, we can flexibly control the display style of each item, such as article summary, thumbnail, publish time, and so on.
    • Details display:{% archiveDetail %}/{% categoryDetail %}and{% pageDetail %}Used to obtain the detailed information of documents, categories, and single pages. Throughnameparameters, we can accurately call any fields such as title, content, images, descriptions, and usesafeThe filter safely outputs content containing HTML.
    • Pagination feature:{% pagination %}with the tag andarchiveListUsed together, it can automatically generate a beautiful pagination navigation, making a large amount of content well-organized.
  4. Enhance interaction and content organization: {% guestbook %}The tag can automatically generate the background configuration of the message form, convenient for users to submit information.{% linkList %}It is used to manage friend links.{% tagList %}and{% tagDataList %}Tags help display and utilize the website's tag system, linking related content together, enhancing content depth and SEO effectiveness.

  5. Logical control and code reuse: {% if %}Tags are used for conditional judgment, such as determining if there are images, subcategories, etc., to adjust the layout.{% for %}Tags are used for looping through data lists, which is the foundation for dynamic content display.{% include %}Used to introduce common code snippets, such as headers and footers;{% extends %}Used for template inheritance, building a unified page skeleton;{% macro %}Then you can define reusable code blocks, reducing repetitive writing.

The fourth step: expand the data dimension through the content model, tapping into personalized potential

AnQiCMS one of its biggest highlights is its 'flexible content model' and 'custom field' feature. This gives us unlimited imagination space to define and display content.

In the background, we can create or modify content models (such as the "article" model or the "product" model), and add various custom fields, such as: *

Related articles

How to ensure that the AnQiCMS website content is displayed efficiently to cope with high concurrency access?

When operating a website, whether the content can be presented quickly and stably to users, especially during periods of increased traffic, is a key indicator of the efficiency of a content management system.AnQiCMS is a system developed based on the Go language, which has fully considered performance in high-concurrency scenarios from the beginning of its design.Understand and make good use of its built-in features and recommended strategies, which can help us better cope with traffic challenges.**The foundation of AnQiCMS performance: an efficient and stable architecture** The reason why AnQiCMS can operate efficiently in high-concurrency environments is inseparable from the technical choices at the bottom layer

2025-11-08

The `repeat` filter in AnQiCMS template design, in addition to text repetition, what are some creative or practical uses?

The template system of AnQiCMS (AnQiCMS) provides a wide space for content display with its flexibility and powerful functions.Among many built-in filters, the `repeat` filter appears to be just a simple text copy at first glance, but as long as we step out of the conventional thinking, it can bring unexpected creativity and practical value to template design and content operation.It is not just a tool to repeat a text multiple times, but also a tool that can cleverly integrate into design, enhance user experience, assist development, and even realize lightweight data visualization.First, we can turn

2025-11-08

How to extract a specified element from a string or array at a specified start and end position in the AnQiCMS template to achieve content snippet extraction?

In AnQiCMS template design, sometimes we need to accurately extract a specific part from a long text or a data list.Whether it is to extract the summary of an article, display several images in a carousel, or process part of an array of data, the ability to flexibly operate on string and array fragments is crucial.A powerful template engine for AnQiCMS, drawing on the syntax features of Django templates, provides us with concise and efficient 'filters' (Filters) to easily meet these needs.Understanding Core: `slice`

2025-11-08

How to convert the first letter, all letters, or the first letter of each word of an English string to uppercase in AnQiCMS template to meet the typesetting standards?

In website content operation, maintaining consistent text formatting is the key to enhancing user reading experience and professional image.Especially for English strings, sometimes we need to capitalize the first letter, all letters, or the first letter of each word according to design or convention.AnQiCMS (AnQiCMS) template system provides us with a flexible and efficient way to meet these layout requirements.The template engine of AnQi CMS is designed to borrow the simplicity and power of Django templates, allowing us to display data and control the page structure through intuitive syntax. Among them,

2025-11-08

How to control the display permission of content based on user groups or VIP levels in AnQiCMS?

In AnQiCMS, flexible content permission control is a key factor in achieving differentiated operations, content monetization, and improving user experience.If you wish to display different content for different user groups, such as ordinary visitors, registered members, or VIP users, AnQiCMS provides a comprehensive user group and VIP level management function, making the refined distribution of content easily accessible.Understand the core content permissions of AnQiCMS One of the core advantages of AnQiCMS is its powerful "User Group Management and VIP System"

2025-11-08

How to optimize the URL structure of the AnQiCMS website to make it more search engine friendly?

The importance of website URL structure is often undervalued, but it has a profound impact on search engine optimization (SEO) and user experience (UX).A clear, concise, and meaningful URL that not only helps search engines better understand the page content, improve crawling efficiency and ranking, but also allows users to have an expectation of the page content before visiting, thereby enhancing trust and click-through intention.AnQiCMS (AnQiCMS) understands this and provides powerful and flexible tools to easily optimize the URL structure of your website.###

2025-11-08

How does AnQiCMS manage and display content for multiple independent sites?

In today's increasingly refined digital marketing era, companies and individuals often need to manage multiple independent sites to meet the content display needs of different brands, regions, or business lines.AnQiCMS was born to address this challenge, with its powerful multi-site management capabilities, allowing content operators to easily navigate the complex multi-site ecosystem.### AnQiCMS Multi-site Management Concept and Advantages AnQiCMS has always fully considered the needs of users for multi-site management in its design, aiming to provide a simple and efficient solution

2025-11-08

How does AnQiCMS support switching and displaying multilingual content to reach global users?

In today's digital age, websites are no longer just information发布 platforms for local markets, but are also important windows for reaching global users and expanding international business.To meet the language needs of users from different countries and regions, it is crucial to build a website that supports multilingual content.AnQiCMS, as an efficient content management system, is designed to meet this challenge. It provides a complete solution to help users easily switch and display multilingual content. AnQiCMS

2025-11-08