In a content management system, flexibility is the key to improving operational efficiency and meeting personalized needs.AnQiCMS (AnQiCMS) is well-versed in this, providing powerful custom parameter functions, allowing users to flexibly expand content attributes according to business characteristics, and accurately display this information in front-end templates.This article will discuss in detail how to set custom parameters in the Anqi CMS backend and how to call them in front-end templates to create a more expressive and functional website.
The magic of custom parameters: Flexible configuration and display of personalized content in Anqi CMS
In today's rapidly changing internet environment, website content is no longer standardized and uniform, but needs to show unique personality and depth according to different business scenarios and user needs.AnQiCMS (AnQiCMS) understands this and provides powerful custom parameter functions for you, allowing you to easily expand content properties, create highly customized information displays, thereby significantly improving website operation efficiency and user experience.
1. Set custom parameters in the background
The custom parameter settings of AnQi CMS are distributed across multiple key modules, aimed at meeting the personalized needs of different levels and types.Understanding the location and function of these settings is the first step in flexibly using custom parameters.
1. Custom fields in the content model: Add exclusive properties for articles and products
This is the most commonly used and most important custom parameter setting entry.Imagine that your website might have both regular articles and detailed product introductions.Different types of content require different dedicated fields to describe.
Set path: Enter the Anqi CMS backend and navigate to“Content Management”-u003e“Content Model”. Here, you can choose to edit an existing model (such as 'Article Model', 'Product Model'), or create a new content model.
Create custom fieldsIn the model editing interface, you will see an area named“Content model custom field”. Click add to start defining new fields.
- Parameter Name: This is the field name displayed during the background editing, should be clear and understandable, such as "source of article", "product model", "house area", etc.
- Field invocationThis is the unique identifier used to call this parameter in the front-end template, it is recommended to use concise lowercase letters or camel case naming, for example
source/modelNumber/area. - Field type: Anqi CMS provides various field types to adapt to different data formats:
- Single-line text: Suitable for short text information.
- Number: Ensure the validity of the numerical values in the input content.
- Multi-line text: Suitable for long descriptions or notes.
- Single choice/Multiple choice/Dropdown choice: When you need to preset some options for editors to choose from, these types are very useful. You can enter each option on a new line in the "default value".
- Mandatory?:According to the importance of the field, decide whether to fill in the content when it is published.
- Default value:Set a default value for the field, which will be automatically used if it is not filled in during content editing.
Application scenario:When you are“Content Management”-u003e“Publish document”After selecting a content model that includes custom fields, these custom fields will appear on the document editing page.“Other Parameters”in the collapse box for you to fill in.
2. Global settings custom parameters: website-level personalized configuration
Some information is universally applicable across the entire site, not attached to specific articles or products, such as specific brand slogans, help page links, or statistics code switches, etc.
- Set path: Go to“Background Settings”-u003eGlobal function settings.
- Create custom parametersFind at the bottom of the page,"Custom Setting Parameters"Area, you can add new parameters.
- Parameter NameAs a template call identifier, for example,
HelpUrl/BrandSlogan. - Parameter valueThe specific content of the parameter, such as,
https://en.anqicms.com/help. - NoteFor internal management and understanding convenience,
- Parameter NameAs a template call identifier, for example,
3. Set up contact information with custom parameters: Expand your communication channels
In addition to the default contact information such as phone numbers and email addresses, you may need to display more international contact methods, such as WhatsApp.
- Set path: Enter“Background Settings”-u003ethe "Contact Information Settings".
- Create custom parameters: Similarly, find at the bottom of the page."Custom Setting Parameters"Add the contact information you need, for example
WhatsAppand its corresponding contact number.
4. Custom parameters for single pages and category pages: detailed control at the page level
The Anqi CMS also allows you to add custom parameters for specific single pages or content categories.These fields will appear in the "Other Parameters" section of the corresponding single-page edit or category edit interface.For example, you can add a "team slogan" field to the "About Us" page or add a "feature advantage" description for a product category.The way it is set up is similar to the custom field of the content model.
5.diy(Custom Content) label: A more generic content snippet
AnQi CMS provides a feature named "Custom Content" (corresponding to the front-enddiyTags), used to manage some common and reusable content snippets, such as a fixed advertisement, a small notification bar content, etc. Although the document does not directly provide detailed instructions for the backend entry, its design concept is similar to the above custom parameters, that is, by defining a name and the corresponding value, in the template through{% diy with name="参数名" %}to call.
Second, flexibly call in the front-end template
After setting up the background parameters, the next step is to present this personalized information to the visitor in the front-end template.The AnQi CMS template engine (similar to Django syntax) provides concise and powerful tags and filters, making the process intuitive.
1. Call the custom fields in the content model
This is the most core calling scenario in the front-end, mainly for article, product and other detail pages.
Directly call a specific fieldIf you know the name of the custom field "call field", you can directly go through
{{archive.调用字段名}}or usearchiveDetailtags to obtain.- For example, you have added a call field called for the article model
authorCustom field, can be directly used on the article detail page{{archive.author}}to display the author - or use tags:
{% archiveDetail with name="author" %}.
- For example, you have added a call field called for the article model
Loop through all custom fields: Sometimes, you may want to dynamically list