In AnQiCMS (AnQiCMS) design philosophy, modularization is one of its core advantages, aiming to provide users with efficient, customizable and easy-to-expand content management solutions.When we talk about the secondary development and expansion of content display functions, it is this modular design that plays a key role, allowing users to create highly personalized website experiences according to their own needs without touching the core code.
Understanding the foundation of modular design
The modular architecture of Anqi CMS is like a set of精密 puzles, each functional unit is an independent puzzle piece.This design brings significant benefits: each functional point can be independently upgraded and expanded, greatly enhancing the system's adaptability and also reducing the long-term maintenance costs.This means that whether it is a website operator or a developer, they can freely customize the display of content within the framework provided by Anqi CMS without worrying that changes will cause a chain reaction.
Content Model: The core driving force of custom content
The content model is an important part of AnQi CMS that supports flexible content display.The system allows us to customize content models according to specific business needs, which means we can create content structures such as articles, products, events, cases, and define unique fields for each type.
For example, a "product" model may need to include fields such as "product name", "price", "stock", "parameter list", and "multiple product images" etc.Through the content model management interface on the backend, we can easily add these custom fields and specify their types (such as single-line text, numbers, multi-line text, radio, multiple choice, etc.).Once the content model is defined, all content of that type will follow this structure.When displaying content, these custom fields can be directly called through template tags, allowing each content type to be presented in the most suitable way for its characteristics, greatly enhancing the personalization and system adaptability of content publishing.
Template System: The 'brush' for content display
The AnQi CMS template system is a powerful tool for secondary development and expansion of content display.It adopts a template language similar to Django, which allows users familiar with front-end development to quickly get started.The entire template system revolves around the following aspects, providing infinite possibilities for content display:
Flexible template file organization:All template files are stored centrally in
/templateIn the directory, and supports folder organization or flat organization mode. At the same time,config.jsonThe file defines the basic information of the template, andpartial/The catalog is used to store reusable code snippets such as headers, footers, and sidebars. This clear structure makes template management and collaboration orderly.Code reuse and structure inheritance:
includeLabels allow us to embed common code snippets (such as header, footer navigation) into any template, avoiding repetition and improving development efficiency.extendsTags support template inheritance, we can define a basic skeleton (base.html), and then let other page templates inherit this skeleton and only rewrite specific blocks within it (blockThis is crucial for maintaining the overall style consistency of the website while allowing flexible adjustments to the local sections.macroLabels take it a step further, allowing us to create reusable code blocks (similar to functions), dynamically generate content in templates based on passed variables, further enhancing the maintainability and reusability of templates.
Rich built-in tags and filters:AnQi CMS provides nearly 40 built-in template tags covering all aspects of content display. Whether it is to get a document list (
archiveList), category details (categoryDetail), single page content (pageDetail), or breadcrumb navigation (breadcrumb)友情链接(linkList), even system configuration information (system) and contact information (contact) have corresponding tags that can be directly called. In addition, a large number of filters (such assafe/truncatechars/stampToDate/addetc.) then gives us the ability to refine content processing, such as safely outputting HTML content, truncating long text, and formatting timestamps.These tags and filter combinations allow us to achieve various complex and dynamic content display effects without writing a single line of backend code.seamless integration of custom parameters:By using the "Global Feature Settings" and "Contact Information Settings" in the background, we can add any custom key-value pair information to the website. This information can be displayed in the template via
systemorcontactLabel can be easily called, which brings great flexibility to content display, for example, adding a 'WeChat customer service QR code' or a 'specific event link', all of which can be displayed directly in the template after configuration in the background.
Flexible application of extended features
Modular design is not only reflected in the content and template itself, but also extends to various website functions:
- Custom URL static page:We can customize the structure of the URL according to the needs. For example, set the article link to
/articles/title.htmlor/archives/id.htmlThis not only helps with SEO optimization, but also makes the URL structure of the website more readable and logical, thereby indirectly affecting the display of content and the user's access experience. - Content display under multi-site management:Even when running multiple AnQiCMS sites on the same server, due to their modularization and independence, each site can have completely independent template and content display logic.This allows an AnQiCMS set to support independent content display needs for multiple brands or businesses.
- Opening of the API interface:Although it is not directly used for front-end content display, the provided API interface (such as importing articles, friendship links, etc.) allows it to integrate with other systems, delivering the content managed by AnQiCMS to more platforms for display, thereby expanding the ability to display content on a wider level.
In summary, the modular design of Anqi CMS provides a solid foundation and a high degree of freedom for the secondary development and expansion of content display functions.From the flexible definition of content structure, to the highly customized and reusable level of templates, and even to the refined configuration of various functions, without touching the core code, making the website able to quickly respond to business changes and continuously iterate and develop.
Frequently Asked Questions (FAQ)
How to apply completely different display templates for different types of content (such as articles, products)?The AnQi CMS supports this through the combination of 'Content Model' and 'Category Template/Documents Template'.Firstly, create content models for articles and products separately in the background and define the corresponding fields.Then, you can set a custom "category template" for a specific "category" (for exampleproduct/list.htmlUsed for product lists,article/list.htmlUsed for article lists), even a single document can specify a document template (such asproduct/detail-iphone.htmlUsed for iPhone product details). The system will automatically match and load the corresponding template file based on the content model or ID, achieving diverse display effects.
How to obtain and display the additional information I customized in the background "Global Settings" in the template?In the AnQi CMS backend, in the "Global Function Settings" or "Contact Information Settings", you can add "Custom Parameters" (for example, parameter name isCustomSlogan,The parameter value is “Make website building simpler”)。Then, you can use `{% system with name=“CustomSlogan” %}