How to customize the Anqi CMS template to meet the unique layout requirements of the website content?

Calendar 👁️ 83

In the digital age, a unique and functional website layout is the core element to attract users and convey brand information.AnQiCMS (AnQiCMS) is an enterprise-level content management system based on Go language, with its efficient and customizable features, it provides users with great flexibility, allowing you to easily build websites that meet specific content layout requirements.

Take full advantage of the powerful capabilities of AnQi CMS, custom templates are the key to personalized design.This not only involves visual beauty, but also concerns how to organize and display your website content efficiently.

Understanding the Anqi CMS template mechanism

The template design of AnQi CMS borrows the syntax of Django template engine, which makes the learning curve relatively smooth. Template files are suffixed with.htmland stored uniformly in the root directory./templateIn the folder. It is recommended to keep the accompanying styles (CSS), JavaScript scripts, and images, etc., in a separate location./public/static/Directory, maintain the purity and manageability of the template file.

In AnQi CMS, variables are usually enclosed in double curly braces.{{变量}}Print, while logical tags such as conditional judgment and loop control use single curly braces and percent signs.{% 标签 %}To define, and most often need corresponding end tags. This clear syntax structure makes the logic of the template clear.

The system also supports various template types, including adaptive (responsive) templates, code adaptation templates, and PC + mobile independent site modes. If you choose the latter two modes, you can create them in the template root directory.mobileSubdirectory, design independent template files for mobile end, to achieve finer device adaptation.

Core customization points: from content to layout

Custom templates are not just about changing colors and fonts, but also about how to flexibly manage and display content.AnQi CMS provides multi-level customization entries, allowing your website layout and content to be deeply integrated.

  1. Content model and custom fields: The content on the website is diverse, ranging from traditional articles, news updates to product displays, case studies, and their structures are often different.The AnQi CMS allows you to customize content models according to your business needs and add exclusive custom fields for each model.For example, if you want to display a product, in addition to the title and content, you may also need fields such as "product model", "color", "price", etc.After defining these fields in the background, you can use them in the template,archiveParamsEasily retrieve and render these custom data, achieving a unique customized layout for the product detail page.This greatly expands the expressiveness of the content, allowing each type of information to be presented in the most appropriate way.

  2. Category and Single Page Template:Sometimes, you may want a specific category (such as the 'Download Center') or an independent single page (such as 'About Us') to have a layout and visual style completely different from other pages.The AnQi CMS provides the functionality to specify a custom template for a single category or single page.You just need to create a file in the template directory with a specific naming convention, such as creating a document for ID 10{模型table}/10.htmlOr create a category with ID 1{模型table}/list-1.htmlOr even create a single pagepage/about-us.htmlThen specify the use of the template file in the background content management or page management.This way, you can design a dedicated display page for the key part of the website, meeting the needs of highly customized layouts.

  3. Customize system and contact information:General information of the website, such as the website name, Logo, filing number, copyright information, and contact information (phone, address, email, social media links, etc.), can all be centrally managed through the background. You can use it in the template.systemTags andcontactTags conveniently call up this information. Furthermore, you can also add custom parameters in the background system settings and contact information settings to provide more globally callable information for the template, such as special promotional slogans or partner lists. You can update the common content of the website without modifying the code.

Master template tags, fine control content

AnQi CMS provides rich template tags, which are the bridge connecting website content with front-end layout. Proficiently using them will make your template customization work twice as efficient.

  1. Data call: Rich and diverse tags:

    • Content list and details: archiveListandarchiveDetailA powerful tool for processing core content such as articles, products, etc.archiveListYou can flexibly display content lists based on category ID, model ID, recommendation attributes, sorting methods, and other conditions, and support pagination.archiveDetailIt is used to display detailed information of a single content, including its custom fields.
    • Categories and pages: categoryListUsed to display the category hierarchy,categoryDetailGet the details of a single category.pageListandpageDetailIt is used for the display on a single page.
    • Site general information: systemTags call the website name, Logo, basic URL, and other global settings.contactLabels are used to output contact information such as phone numbers, email addresses, and more.tdkTags help you dynamically set the Title, Keywords, and Description required for SEO on different pages.
    • Navigation and friendly links: navListCan flexibly build multi-level website navigation menus.linkListIt is used to display friend links.
  2. Logic and loops: Build dynamic layout:

    • Conditional judgment: if/elif/elseTags make the template able to display or hide content blocks based on different conditions.For example, you can set the image to be displayed only when there is an article thumbnail, or display different menu items after the user logs in.
    • Loop traversal: forThe loop tag is the core for handling list data. Whether it's an article list, category list, or multiple contents in a custom field, it can be displayed one by one throughforcoordinated.forloop.Counter(Current loop count),forloop.Revcounter(Remaining loop count) and other variables, it can also implement more complex layouts, such as adding special styles to the first or last element.
  3. Modularization and reuse: Enhance development efficiency:

    • Template inheritance: extendsTags allow you to define a basic layout file (usuallybase.html), which includes the common structure of the website (such as header, footer, sidebar). Other page templates simply inherit this basic layout and fill or override specific content blocks (block), greatly improved the development efficiency and maintenance convenience.
    • The code snippet includes: includeLabels can isolate commonly used UI components or code snippets (such as headers, footers, sidebars) into separate files and then import them where needed.This helps to avoid code repetition, making the template structure clearer.
    • Macros: macroThe tag allows you to define reusable functional code blocks, which can accept parameters and generate specific HTML structures, especially suitable for components that repeat but have slightly different content.
  4. Advanced feature: SEO and user interaction:

    • paginationTags are used to build pagination functionality for article lists.
    • guestbookTags can generate message forms, making it convenient for users to consult online.
    • archiveFiltersUsed to filter the list according to document parameters, in product display or

Related articles

How to optimize the setting of website URL static rules to enhance content display effect and SEO ranking?

In website operation, URL (Uniform Resource Locator) is not only the path for users to access the page, but also an important clue for search engines to understand the content and structure of the website.A well-optimized URL structure plays a crucial role in improving content display and SEO ranking.AnqiCMS (AnQi CMS) takes full consideration of SEO-friendliness in its design, providing flexible and powerful static rule management functions, allowing us to easily create beautiful and SEO-friendly URLs according to the needs of the website.Why do websites need static URLs

2025-11-08

How to configure and display multilingual website content in AnQi CMS?

AnQiCMS is dedicated to helping users easily meet the needs of global content promotion. It has built-in multilingual support functions, allowing you to flexibly configure and display different language versions of website content.No matter if you want to provide translations for static text in templates or create independent language versions for articles, products, and other core content, AnQi CMS offers intuitive and powerful tools.Next, we will explore how to configure and display multilingual website content in Anqi CMS.### The First Part

2025-11-08

How to use AnQi CMS to realize personalized display of different content models (such as articles, products)?

AnQi CMS is an efficient and customizable content management system, one of its core advantages is the flexible content model.This provides website operators with great freedom, allowing us to design unique structures and display methods for various content types such as 'articles', 'products', etc., thus realizing the personalized presentation of website content.Next, we will delve into how to take advantage of the powerful functions of AnQi CMS to achieve personalized display of content models.Understanding the content model of Anqi CMS

2025-11-08

How to display the friend link list on the AnQiCMS front-end page?

Friendship links are a way for websites to recommend each other, not only can they increase the number of external links to the website, but also be beneficial for search engine optimization (SEO), but also provide visitors with more entry points to related resources, enhancing the user experience.AnQiCMS provides a very convenient function for us to manage and display friend links. Next, we will learn together how to set up friend links in AnQiCMS and display them on the website's frontend page.### One, manage the friendship link in AnQiCMS background In AnQiCMS, managing friendship links is very intuitive

2025-11-08

How to ensure efficient loading and display of images, videos, and other media resources on the page in Anqi CMS?

When operating a website, we all hope to provide visitors with a smooth and pleasant browsing experience.Among them, the loading speed of images, videos, and other media resources is undoubtedly a key factor affecting the experience.If the media resources on the page load slowly, visitors may become impatient and even leave directly.Lucky for it, AnQi CMS took full consideration of this from the beginning, providing various functions and strategies to help us efficiently manage and display these valuable resources.

2025-11-08

How to enhance the visibility of website content in search engine results using the advanced SEO tools of Anqi CMS?

In today's information explosion internet world, making your website content stand out among the vast sea of search results is a goal that every operator desires to achieve.Search engine optimization (SEO) is no longer optional; it is the foundation of success.Lucky for AnQiCMS (AnQiCMS) to know this, and it has built a series of powerful advanced SEO tools to help us easily improve the visibility of website content.AnQi CMS is dedicated to providing efficient content management solutions for small and medium-sized enterprises and content operation teams, with SEO-friendliness taking a core position in its design philosophy

2025-11-08

How does AnQi CMS's multi-site management function help unify the management and display of results from different brands or sub-sites?

In today's digital age, businesses or individuals often need to manage multiple online platforms to adapt to different brand positioning, product lines, or market strategies.This multi-site operation model is prone to falling into the困境 of repetitive work, scattered resources, and high maintenance costs if it lacks an efficient management tool.AnQiCMS (AnQiCMS) takes advantage of its powerful multi-site management features, providing users with an elegant solution to help us achieve unified management and flexible display of different brands or sub-sites.

2025-11-08

In Anqi CMS template, how does the `stringformat` filter accurately format any number into a string with a specified number of decimal places?

The formatting of numbers in the presentation of web content is often a key detail that reflects professionalism.Whether it is product prices, statistical data, or financial reports, precisely controlling the output of decimal places can not only improve user experience but also ensure the accuracy of information.In Anqi CMS template design, the `stringformat` filter is the powerful assistant to solve this problem.

2025-11-08