In AnQi CMS{% diy %}The core use and in-depth analysis of custom content tags
As an experienced website operations expert, I am well aware of the importance of a flexible and scalable content management system for the efficient operation of a website.AnQiCMS (AnQiCMS) stands out among many CMS products with its powerful customization capabilities.And within its rich template tag system,{% diy %}(Do It Yourself) Custom content tags are undoubtedly a core tool for achieving high website personalization and operational efficiency optimization.
Then,{% diy %}This seemingly simple label, what is its core function? In short, it provides a kind ofUnder the premise of not modifying the template code, define and call arbitrary custom text or link information from the backgroundThe mechanism. It goes beyond the fixed functions set by the system, giving operators great freedom, allowing them to centrally and conveniently manage those scattered contents throughout the website that may need frequent updates but do not belong to specific articles or products.
{% diy %}Beyond the preset, realize personalized content display
Anqi CMS provides such as{% system %}(System settings),{% contact %}Contact information and a series of built-in tags are used to call global information such as website name, phone number, and email address.These tags are indeed practical, but in the operation of a website, there will always be some special needs: such as placing a daily updated brand slogan at the bottom of the website, or displaying a social media link that does not belong to the regular contact information in a corner of a page, or a notice text that needs to be frequently adjusted during a promotional campaign.This information does not belong to the basic system configuration, nor does it classify as contact information, nor is it a specific field for an article or product. At this point,{% diy %}Labels become a way to solve such problems.
By using the "Global Function Settings" or "Contact Information Settings" area of the AnQi CMS backend, operators can create any number of custom key-value pairs according to their own needs.For example, you can define a parameter named "CompanySlogan" with the value "Let your creativity extend infinitely!"}Please define a parameter named "WeiboLink" with the value of your Weibo homepage link.Once these parameters are set up in the background, you can go through{% diy %}Labels easily call out their content. This greatly decouples the website content from the template structure, making content updates as simple as filling out a form.
Why{% diy %}So important? Analysis of practical scenarios.
{% diy %}The importance of tags is reflected in many aspects, especially for teams pursuing refined operation, its value is immeasurable:
- Flexible update of the core information of the website:The brand slogan of the website, partner list, festive greetings, urgent announcements, etc., these contents often need to be adjusted quickly. Use
{% diy %}The operation personnel does not need to contact the technical team to modify the template file, they can directly update the parameter values in the background, which greatly shortens the response time. - Integrate third-party service links or IDs:links to social media platforms (such as Facebook, Twitter, LinkedIn, etc.), or some third-party statistical codes, customer service system IDs, and so on, can be accessed through
{% diy %}Manage uniformly. When a link changes or needs to be replaced with a service provider, it can also be modified with one click in the background, avoiding the麻烦 of searching and replacing one by one in the code. - Personalized content display switch:Imagine that you may need to display a banner notification on the homepage during a special period. You can define a
{% diy %}Parameters, such as "HomeBannerText", and determine in the template whether this parameter has a value or is a specific value to decide whether to display the banner.This, the display and hide of notifications can be easily controlled in the background. - Differential configuration of multi-site content:If your AnQi CMS has deployed multiple sites,
{% diy %}CombinesiteIdParameters can implement custom information with the same parameter name but different content across different sites, meeting the specific needs of multi-brand or multi-region operations.For example, different sites can have different customer service phone numbers or localized slogans.
it is just these practical scenarios that make,{% diy %}It is an indispensable tool for Anqi CMS template development and website operation, making the static part of the website come alive and respond more agilely to market changes.
How to elegantly use in the template{% diy %}
Use{% diy %}The tag is very intuitive, and its syntax structure is clear and straightforward. The basic format is: {% diy 变量名称 with name="字段名称" %}The field name is the parameter name you set in the Anqi CMS backend.
For example, if you add a custom parameter in the background global settings, named "CustomerServicePhone" (with the parameter value set to "400-123-4567"), then in your template, you can call it like this:
<p>24小时客服热线:{% diy customerPhone with name="CustomerServicePhone" %}{{customerPhone}}</p>
here,customerPhoneIs the temporary variable name you specified for this custom content, by{{customerPhone}}You can display the value '400-123-4567' in the template. If you do not want to declare an additional variable, you can also output directly:
<p>24小时客服热线:{% diy with name="CustomerServicePhone" %}</p>
In a multi-site environment, if you need to call custom parameters for a specific site, you can addsiteIdfor example:{% diy with name="CustomNotice" siteId="2" %}This will call the "CustomNotice" parameter value defined by the site with ID 2.
In practice, to ensure code readability and maintainability, it is recommended to{% diy %}The content called by the tag defines a meaningful variable name and combines it with HTML semantic tags for output.
{% diy %}The difference with other tags: clarify the boundaries.
In the Anqi CMS tag system,{% diy %}/{% system %}/{% contact %}and{% archiveParams %}they all involve data retrieval from the backend, but they have different core uses and data sources. Understanding these differences is the key to efficient operation.
{% diy %}with{% system %}/{% contact %}:{% system %}and{% contact %}The label is used to retrieve the Anqi CMS systemPredefined/Fixed fieldGlobal information, such as 'Website name', 'Record number', 'Contact number', etc, while{% diy %}is used to retrieve the operatorself-created/Unspecified fieldIs the global custom information. It can be understood as{% system %}and{% contact %}Is the standardized plug provided by the official{% diy %}And the one you customize or add as needed is the extended socket.{% diy %}with{% archiveParams %}:{% diy %}Is obtainedgloballyInformation that is not attached to any specific content (such as articles, products), and{% archiveParams %}Tags are used to retrieveCustom fields defined under a specific content model (such as articles, products)These fields are associated with a specific article or product. For example, a product has custom parameters such as 'product model', 'manufacturing date', and these parameters need to be transmitted through{% archiveParams %}Call it, and it usually only takes effect on the product detail page.{% diy %}Not at all, it retrieves data that is universal to the entire website, or associated with the website itself rather than a specific content item.
In summary,{% diy %}The custom content tag is a microcosm of the highly customizable features of AnQi CMS, which greatly enhances the flexibility and operational efficiency of the website.By using it reasonably, operators can more conveniently manage and update unstructured, personalized information on websites, thereby better serving content marketing and brand promotion strategies.
Frequently Asked Questions (FAQ)
Q1:{% diy %}Tags and{% system %}/{% contact %}What are the main differences between tags?
A1: {% system %}and{% contact %}The label is used to call the AnQi CMS system's preset, standardized field global information, such as "Website Name", "Website Record Number", "Contact Phone" and so on.{% diy %}The tag is used to call the global information parameters that you create yourself in the background "Global Feature Settings" or "Contact Information Settings" under the "Custom Parameter Settings".In simple terms, the former is a built-in standard feature, while the latter is a feature expanded by users based on personalized needs.
Q2: Can I use{% diy %}tags to call the custom fields I define for articles or products?
A2: No.{% diy %}tags are used to call the websitegloballyCustom parameters, these parameters are unrelated to any specific article or product. If you need to call custom fields defined for content models such as products (such as the "model", "color", etc.), you should use{% archiveParams %}Tags, it is specifically used to obtain custom parameters for specific content items.
Q3:{% diy %}Which type of content is best managed by tags?
A3: {% diy %}Tags are best suited for managing those