How to create custom fields for different content models (such as articles, products) in AnQiCMS?

Calendar 👁️ 51

Good, as an experienced website operation expert, I am very willing to analyze the powerful functions and actual operations of the customized fields in AnQiCMS for you in depth.


In AnQiCMS, create custom fields for different content models: unlock the powerful engine of personalized content

In the era where content is king, the diversity and personalization of website content are crucial to attract and retain users.A great content management system (CMS) should never limit you to a fixed content structure.AnQiCMS is well-versed in this, and its 'flexible content model' function is precisely designed to grant operators such capabilitiesCreate custom fields for different content models (such as articles, products)Thus, make your website content management more skillful and unique.

Understand the content model: the foundation of all personalization.

In AnQiCMS, all the content on your website is organized around the 'content model'.The system is default built-in with the two core models of "Article Model" and "Product Model", which define the basic information structure of articles and products respectively.However, the business requirements in reality are much more complex. An industry analysis article may require 'analyst name', 'report source';And an e-commerce product may need additional information such as 'color options', 'size details', 'material description', etc., besides the usual 'price' and 'inventory'.At this time, a custom field is naturally created.

Custom fields allow you to add any data items you think are necessary based on the existing content model to accurately reflect the unique properties of your content.This greatly enhances the flexibility of content management, and also provides more possibilities for front-end display and SEO optimization.

How to create custom fields in AnQiCMS?

The process of creating custom fields is intuitive and efficient, let's go through it step by step:

First, log in to the AnQiCMS backend management interface, find the "Content Management" in the left navigation bar, and then click to enter the "Content Model".Here, you will see the list of all content models on the website, including built-in 'article model', 'product model', and other custom models you may have created.

Select the content model you want to edit by adding a custom field.For example, if you want to add more attributes to e-commerce products, click on "Product Model" to enter its details page.On this page, you will see a name calledCustom fields for content modelHere is the region. That's where we cast our magic.

Click the 'Add Field' button, and a new field configuration form will appear in front of you. Here, you need to fill in some key information:

  1. Parameter name:This is the display name of the field, convenient for you to identify and operate in the background management, such as "author name", "product material", "release date", and so on.Suggest using clear and understandable Chinese names.

  2. Call field:This is crucial! "Field name used" is the actual field name stored in the database, as well as the unique identifier used when calling this data in the template.Please make sure to useEnglish lettersAs a field name, do not include spaces. For example, "Author Name" can be set toauthorName,"Product Material" can be set tomaterial. Remember this name, it will be the 'key' to retrieve data in the template.

  3. Field type:AnQiCMS provides various field types to meet different data storage needs.

    • Single-line text:Suitable for storing brief string information, such as the author's name of an article or the brand of a product.
    • Number:Designed specifically for numbers, like a product's 'price' or 'stock quantity' is very appropriate.
    • Multi-line text:As the name implies, it is used to input longer text content, such as a product's 'detailed features description' or an article's 'additional summary'.
    • Single choice, multiple choice, dropdown choice:These three types are suitable for providing preset options for users to choose from.For example, set the 'Color' option for the product (red, blue, green), and you can choose whether it is single selection or multiple selection.When selecting these types, you need to enter an option in the "Default Value" area on each line, and the system will automatically parse it as an optional item.
  4. Mandatory?:Check according to business requirements. If this field is a mandatory item for content publication, please check this box. The system will verify it when submitted.

  5. Default:If this field has a commonly used value at content creation, it can be preset here. For selection-type fields, this is used to define all optional items.

Configure the field and click "OK" to save. You can add any number of custom fields to the same content model as needed.

Use custom fields when publishing content

After you complete the creation of custom fields and associate them with a content model, these fields will dynamically appear when you publish or edit content that belongs to the content model.For example, when you add an article or product under "Content Management", in the "Other Parameters" collapsible box of the form, you will find the custom field you just defined listed there.

It is worth mentioning that AnQiCMS's dynamic adaptability is very intelligent.If you define 'author name' for the 'article model' and 'material' for the 'product model', only the 'author name' field will be displayed when publishing the article;When releasing the product, the 'Product Material' field will be displayed.This design of dynamically switching fields based on the content model greatly simplifies the background operations and avoids unnecessary confusion.

Display custom fields in the front-end template

The value of the custom field is ultimately reflected in the front-end display. AnQiCMS provides flexible template tags, allowing you to easily present these custom data on the website page.The name you set when creating the field, which is the key to your interaction with the template.

Assuming you have added a namedmaterial(Called field) custom field named “Product Material”:

Method one: go through directlyarchiveObject calling (for known field names)

In the product details page template, you can directly access througharchive(or a custom document variable name) object to access this field:

<!-- 产品材质 -->
<div>
    <span>产品材质:</span>
    <span>{{ archive.material }}</span>
</div>

Method two: usearchiveDetailLabel call (for retrieving specific fields)

Also can be usedarchiveDetailLabel to get the value of a specific custom field:

<!-- 产品材质 -->
<div>
    <span>产品材质:</span>
    {% archiveDetail productMaterial with name="material" %}
    <span>{{ productMaterial }}</span>
</div>

Method three: usearchiveParamsLabel to iterate through all custom fields (for dynamic display)

If you want to dynamically display all custom fields and their values under a content model (for example, generating a 'product parameters' table on a product details page),archiveParamsThe label will be your **choice.

<!-- 产品参数列表 -->
<div class="product-params">
    <h3>产品参数</h3>
    <ul>
        {% archiveParams params %}
            {% for item in params %}
                <li>
                    <span>{{ item.Name }}:</span>
                    <span>{{ item.Value }}</span>
                </li>
            {% endfor %}
        {% endarchiveParams %}
    </ul>
</div>

Through these methods, you can flexibly render custom field data to the page according to the needs of the frontend design, whether it is simple text display, complex option listings, or rich media content such as images, links, and so on.

Summary

AnQiCMS' custom field function is a vivid manifestation of its 'flexible content model' concept.It empowers website operators with strong content shaping capabilities, allowing you to no longer be limited by fixed content structures, and to adjust and expand the properties of content according to the evolution of business development and content strategies.In order to better organize information, improve user experience, or for more refined SEO layout, custom fields are an indispensable tool in your website operation toolbox.

Master and make good use of the custom fields of AnQiCMS, you will be able to build a truly tailored, dynamic personalized website that will give wings to your content marketing and user growth.


Frequently Asked Questions (FAQ)

1. If I call a custom field in a template by using the field name (for examplearchive.myCustomField), what will happen if I spell it wrong?Answer: If the field name called is spelled incorrectly or does not match the "field name called" set in the background, the template parsing will display blank or an error when it cannot find the corresponding data (depending on your template

Related articles

How does AnQiCMS handle the management of pseudo-static and 301 redirection to solve the problem of URL structure optimization and traffic loss?

## AnQiCMS' Static URL and 301 Redirect: A Smart Solution for URL Optimization and Traffic Protection In the digital wave, a website's URL (Uniform Resource Locator) is far more than a simple address.It is not only the path that users access the page, but also the key clue for search engines to understand the content of the website and evaluate its value.A clear and semantically friendly URL can significantly enhance user experience, improve search engine crawling efficiency and ranking performance.

2025-11-06

How to use AnQiCMS advanced SEO tools (such as Sitemap, Robots.txt) to improve the visibility of a website in search engines?

## Optimize Your Search Engine Footprint: How AnQiCMS Harnesses Sitemap and Robots.txt to Improve Website Visibility In the ever-changing digital world, the search engine visibility of a website is the foundation of its success.No matter if you are running a small and medium-sized enterprise, a self-media platform, or managing multiple sites, ensuring that your content can be discovered and effectively indexed by search engines is crucial for traffic acquisition and brand exposure.

2025-11-06

How does AnQiCMS's document content collection and batch import function improve the efficiency of content construction?

## AnQiCMS: Content collection and batch import, how to drive the leap in content construction efficiency?In today's digital age, website content has become the core of communication between enterprises and users, brand building, and search engine optimization.However, starting from scratch, creating, managing, and updating a massive amount of content is a continuous and time-consuming task for any website operator.The cumbersome collection of materials, manual input, and repeated adjustments not only consume a lot of human and material resources, but may also miss valuable market opportunities.

2025-11-06

How to get the documents of a specified user, or only display the documents under the current category without including subcategories?

As an experienced website operations expert, I am well aware of the importance of a flexible and efficient content management system for website operations.AnQiCMS, with its lightweight, high-performance, and highly customizable features, has won the favor of many small and medium-sized enterprises and content operators.In the daily content operation, we often need to manage and display the website content in a refined manner, among which, how to accurately obtain the documents of a specific author, or only display the content under the current category while excluding the subcategories, is the key to improving user experience and optimizing the content structure.Today, let's delve deeper

2025-11-06

How to get all top-level categories under a specified model for the `categoryList` tag?

Anqi CMS, as an efficient and customizable enterprise-level content management system, provides great flexibility in content organization and display.Among them, skillfully using template tags is the key to leveraging its potential.Today, let's delve into how to use the `categoryList` tag to accurately retrieve all top-level categories under a specified content model, which is crucial for building clear website navigation, content modules, or product display pages.

2025-11-06

how the `categoryList` tag implements nested hierarchical display of multi-level categories?

Sure, as an experienced website operations expert, I am happy to deeply analyze how to implement nested display of multi-level categories in the `categoryList` tag of AnQi CMS and transform it into an article that is easy to understand and practical. --- ## AnQi CMS `categoryList` Tag: Easily Implement Nested Display of Multi-level Categories, Making the Website Structure Clear and Orderly A clear classification system is crucial for user experience (UX) and search engine optimization (SEO) in website operations.

2025-11-06

How to get the link, Logo image, and document count in the `categoryList` loop?

As an experienced website operations expert, I am well aware of the importance of an efficient and flexible content management system for daily operations.AnQiCMS with its high-performance architecture based on the Go language and the friendly syntax of the Django template engine, provides us with great convenience.Today, let's explore a very practical technique in website frontend display: how to elegantly obtain the links, Logo images, and the number of documents under each category in the `categoryList` loop.

2025-11-06

How `tagList` tags display the related Tag list of the specified document?

As an experienced website operations expert, I know that how to flexibly and effectively organize and display content in a content management system is the key to improving user experience and search engine optimization (SEO).AnQiCMS (AnQi CMS) offers many powerful functions in this aspect, and the `tagList` tag is an important bridge to connect content and enhance discoverability.Today, let's delve into how to use the `tagList` tag in AnQiCMS to accurately display the associated tag list of a specified document.### Fine-grained content management

2025-11-06