In website operation, we often need to display personalized information beyond the standard title, content, and publication date.AnQi CMS provides us with the ability to add custom parameter fields to articles, products, and other content, thereby meeting various diverse display needs.This article will thoroughly explain how to obtain and elegantly present these custom parameter fields on the Anqi CMS article detail page, making your content more expressive.

Understand the custom parameter fields of Anqi CMS and their importance

Their importance is reflected in:

  • Personalized display: Allow website content to break free from the monotonous structure, making it more in line with business logic and user expectations.
  • Data structuring: Helps in categorizing, filtering, and managing content, enhancing the organization of data.
  • Operational EfficiencyTo solidify specific information into fields for convenient content editing and subsequent calls.

In the Anqi CMS backend management interface, you can configure these fields under "Content Management" and "Content Model".Each custom field needs a unique 'call field' (also known as 'parameter name') as an identifier for its reference in the template, and you can also choose the data type of the field, such as single-line text, multi-line text (supporting rich text), number, radio, checkbox, or dropdown selection.These backend settings are the foundation for successful front-end calls.

Second: Create custom parameter fields: prerequisite for front-end display.

Before displaying custom parameters on the article detail page, we first need to add these fields in the Anqi CMS backend for the corresponding content model.

  1. Access content model managementLog in to the AnQi CMS backend and navigate to "Content Management" -> "Content Model".
  2. Select or create a new model.In here, you can choose to edit the built-in "article model" or "product model" of AnQi CMS, or create a new content model according to your business needs.
  3. Add custom fieldIn the editing page of the selected model, find the "Content Model Custom Field" area, click "Add Field".
    • Parameter NameThis is the key identifier called in the template, it is recommended to use lowercase letters, for examplearticleAuthor/productMaterial.
    • Field invocationThis is the actual storage name of the field in the database, the system will usually automatically generate according to the parameter name, keep the default.
    • Field type: Choose the data type you want to store.For example, "single-line text“Numbers” are used for numeric data, while “single choice/multiple choice/dropdown” are used for preset options.
    • Mandatory?:Select according to your business logic to ensure that no key information is missed.
    • Default value:You can preset the display content when the field is not filled in during content editing.
  4. Save model settingsAfter adding and configuring all custom fields, be sure to click Save Content Model so that the new fields will take effect when publishing or editing content belonging to the model.

Once the field is created, when you edit or publish an article associated with this content model, you will be able to see and fill in the values of these custom fields in the "Other Parameters" area of the editing page.

Chapter 3, Retrieve and display custom parameters in the article detail page

After setting up the custom parameters in the background, the next step is how to display them in the article detail page on the front end (usually corresponding to the/template/{模型table}/detail.htmlOr you can customize your document template