In website content operation, the way content is presented is the key to attracting users, conveying information, and achieving business goals.AnQiCMS (AnQiCMS) provides a highly flexible custom content model, which is the powerful tool we use to finely control the display of website front-end content.It is not only the background data management, but also the cornerstone of the front-end visual and functional experience.
The foundational role of the flexible content model
One of the core strengths of Anqi CMS is its 'flexible content model' feature.In simple terms, a content model is a preset structural framework for different types of content.Imagine, a product detail page and a news article page, their required information fields must be different: products need price, inventory, SKU, etc., while news needs author, publication time, summary, etc.The Anqi CMS allows us to tailor a dedicated data structure for each content type according to actual business needs, which fundamentally solves the problem of the singleness of content structure.
This flexibility brings obvious user value. It allows the system to easily adapt to various content publishing needs, whether it is complex e-commerce products, simple blog articles, or various scenarios such as event registration and team member introduction.By customizing the content model, we can not only accurately store the required information, but also lay a solid foundation for subsequent frontend display.
Build a dedicated content model: from fields to structure
Building a custom content model in AnQi CMS is an intuitive and powerful process.Firstly, we need to enter the "Content Model" management interface, where we can modify the built-in models of the system and also create new models.
Each time we create a content model, we need to define some basic information, such asModel name(easy for backend identification),Model table name(lowercase, used for database storage),URL alias(crucial for front-end URL structure, important for SEO) andTitle Name(Specify the main title field of the content under this model, such as "Product Name" or "Article Title").
Moreover, we can add a series of features for each model.Custom field. These fields are the soul of the content model, determining what information a specific content type can store.AnQi CMS provides various field types to meet the storage needs of different data:
- Single-line text: Suitable for short text input, such as product models, author names.
- Number: Ensure that the input data is numeric, such as prices, inventory quantities.
- Multi-line text: Suitable for long texts, such as product descriptions, event details.
- Single choice/Multiple choice/Dropdown choiceProvide preset options to facilitate standardized input, such as single selection for product color, multiple selection for service scope, and dropdown for region.
When defining these fields, we can also set whether they are required fields and the default values, which greatly improves the standardization and efficiency of content input.These custom fields give us flexible control over the way we present content on the front end.
Content and classification: the practical application of the model.
After defining the content model, we can make use of it when adding documents or categorizing documents.When we create a new content (such as an article or a product) and select a category for it, the system will dynamically display the corresponding custom fields based on the content model associated with that category.
For example, if we create a content model named "product display" which includes fields such as "product price", "brand", "detail image set", etc.After creating a new category and associating it with the "Product Display" model, all content published under this category will show these exclusive fields in the editing interface.This means that different types of content, even though they all belong to the broad concept of
Template linkage: Convert data into visual
The final display effect of the content depends on the support of the template. Anqi CMS adopts a syntax similar to the Django template engine and uses a set of clear template conventions, allowing us to present the data stored in the custom content model of the backend in various creative ways on the website front end.
- Model-specific template: Anqi CMS supports naming template files according to the table name of the content model, for example
{模型table}/detail.htmlFor the detail page of a single piece of content,{模型table}/list.htmlUsed for the content list page. This means that we can design a set of exclusive list and detail layouts for the "article" model, and another completely different layout for the "product" model, without stacking complex condition judgments in a template. - Dynamically invoke a custom fieldThis is the core of the interaction between the custom content model and the front-end display. We can use
{% archiveDetail with name="字段名称" %}Such a tag, directly extract the value of any custom field. For example, on a product detail page, through{% archiveDetail with name="产品价格" %}Can display the price of the product. If the field is multi-image upload (such as "Details Image Set"), we can use{% archiveDetail arcimages with name="详情图片集" %}then cooperate with{% for img in arcimages %}loop tags to display all images. - conditions and loopsThe power of template language lies in its logical processing capabilities. Through
{% if %}Label, we can make conditional judgments based on the value of the custom field to realize the intelligent display of content. For example, when the inventory fieldStockis greater than 0, display "In stock"; when the activity fieldStatusWhen it is "in progress", it displays "Sign up immediately".{% for %}The loop tag can iterate over multiple choice fields or image sets, flexibly laying out complex data. - Custom template overrides:Even under the same content model, AnQi CMS still provides finer-grained control.For a specific article or category, we can specify a completely independent 'document template' or 'category template' through the backend settings.For example, if the default article detail template is
article/detail.htmlBut we have a special article that needs a name fordownload.htmlThe template is used to display its unique download function, just specify it in the background for the article, which greatly enhances the personalized display ability of the content.
Through the above mechanism, the customized content model of AnQi CMS not only provides a flexible data structure, but also closely integrates with the front-end template, allowing us to finely control the display of the website front-end according to the content type, business logic, and even special needs of individual content, thus building a diverse website that is both beautiful and practical.
Frequently Asked Questions (FAQ)
1. How does a custom content model help with website SEO?The custom content model allows us to create more semantically structured content for different types of content, and can generate corresponding labels for each custom field, which helps search engines better understand the content.For example, setting fields such as "price" and "brand" for the "product" model can generate structured data (such as Schema.org) in the front-end template, thereby improving the search engine's ability to capture and display product information.In addition, by combining the features of pseudo-static, 301 redirection, and TDK settings of Anqi CMS, it can generate more friendly and descriptive URLs for each type of customized content, further optimizing SEO performance.
2. After creating the content model, if you need to modify the field type or name, will it affect the existing data?In AnQi CMS, after the content model is created, it can be modified, but it requires careful operation.Modify the field type (e.g., from 'number' to 'text') or field name ('call field') may cause the corresponding data stored in the existing content to be unable to be correctly parsed or displayed, even lost.Therefore, it is strongly recommended to back up the data and thoroughly verify it in a test environment before making such modifications to ensure that the changes will not affect the normal operation of the website and the integrity of the data.It should be noted that the built-in models of the system can be modified but cannot be deleted directly;And the custom created model will delete all the contents and categories under it when deleted, be extra careful.
3. I have defined an 'article' content model, but some articles require special formatting and features. Can I apply a different layout to a single article?Absolutely. Anqi CMS provides a flexible template overlay mechanism.When adding a document or editing an existing document, you can find an option named "Document Template" in the "Other Parameters" section.Here, you can specify a custom template file for the current document (for exampledownload.html), even if it belongs to the "article" model, the system will prioritize the template you specify to render the page instead of the default onearticle/detail.htmlSimilarly, categories can also be set up through 'category templates' to implement a unified special layout for content under specific categories.This enables us to maintain the structural integrity of the content model while achieving great freedom in frontend presentation.