What types of 'custom content information' can I create in the background for the `{% diy %}` tag to call?

Calendar 👁️ 59

As an experienced website operations expert, I am well aware that it is crucial to manage and call various content flexibly in daily work.AnQiCMS (AnQiCMS) performs very well in this aspect, it provides a series of powerful tags that make content operation effortless.Today, let's delve deeper into the types of "custom content information" you can create in the background as an AnQi CMS user, and through{% diy %}Tags can be flexibly called on the front end of the website.

{% diy %}Labels, as the name implies, is the abbreviation of "Do It Yourself", it plays the role of a universal tool in Anqi CMS, allowing you to manage and call information that does not belong to the regular content system of articles, products, categories, etc., but needs to be repeated at multiple places on the website.This greatly enhances the maintainability and operational efficiency of the website, avoiding the update difficulties brought by hardcoding data in templates.

{% diy %}The custom information sources that the tag can call.

The backend design of Anqi CMS is very user-friendly, allowing you to create available in two main areas.{% diy %}Custom parameter for tag call:

  1. Custom parameter in global function settings
  2. Custom parameters in the contact information settings.

Let's unfold one by one.

1. Custom parameter in global function settings

In the AnQi CMS backend, you can navigate to "Backend Settings" -> "Global Function Settings" to find this area.The 'Custom settings parameters' section opens up a whole new dimension of content management.When the built-in system settings of AnQi CMS (such as website name, Logo, filing number, etc.) cannot meet the specific needs of your website, you can add it yourself here.

You can add custom information types including but not limited to:

  • Business slogan or catchphrase:For example, the top of the website may need a frequently updated marketing slogan, or a promotional slogan for a specific festival event. You can define a name for it here.SloganThe parameter, with the value of 'Some Company, your trusted partner!'
  • External service code: If you need to integrate some third-party statistical code (such as Baidu Statistics, Google Analytics code snippet, but not configured in special SEO tools), customer service chat code, or specific ad placement code, and these codes are not suitable to be directly embedded in template files, you can add them hereAnalyticsCodeorCustomerServiceScriptParameter, and call its value in the template.
  • Collection of social media links:Although Anqicms in the contact information settings provides common social media fields, but if you have irregular or need to dynamically switch social media platform links, such as a special microblog topic link for an eventActivityWeiboLinkOr a promotional link on a specific marketing pagePromotionPageLinkOr you can manage it here
  • Website announcement or prompt information:Short announcements that need to be frequently updated but do not want to be published as articles, such as "Spring Festival Holiday Notice", "System Maintenance Notice", can be defined as one.SiteAnnouncementParameter.
  • Toggle for special features:Imagine that you may have developed a special feature module in some template, but you want the operations personnel to be able to turn it on or off flexibly in the background. You can define one hereFeatureToggleParameter, is set totrueorfalseThen pass through the template{% if diy with name="FeatureToggle" %}to judge.

How to call:Once you have added a custom parameter in the global feature settings, for example, a parameter namedHelpUrlThe help page link, you can call it in any template file in the following way:

<a href="{% diy with name="HelpUrl" %}" target="_blank">获取帮助</a>

This allows non-technical personnel to easily modify the global information of the website without touching the code.

2. Custom parameters in contact information settings

Similar to the global function settings, in the "Background Settings" -> "Contact Information Settings", AnQi CMS also provides default fields such as contact person, phone number, address, and so on.But if these default items are not enough to carry all your contact information, such as when you need to display a WhatsApp number, Skype ID, or a dedicated email for a specific department, you can also use the "Custom Setting Parameter" feature.

You can add custom information types including but not limited to:

  • More instant messaging tool accounts:For example, in addition to WeChat and QQ, you may also need to displayTelegramIDorLineAccount.
  • Contact information in different languages or regions:If your website is multilingual or targets different regions, you may want to display exclusive contact numbers or email addresses for specific languages or areas, such asEnglishSupportEmailorJapanSalesPhone.
  • Service hours:For example, define aCustomerServiceHoursParameters, display “Monday to Friday 9:00 - 18:00”.
  • Store business hours:If it is a physical store, it may be neededStoreOpeningHours.

How to call:Assume you added a custom parameter namedWhatsAppin the contact information settings, you can call it like this:

<p>WhatsApp: {% diy with name="WhatsApp" %}</p>

In this way, your website operators can update this contact information at any time according to the actual situation, without modifying the template code.

Summary

{% diy %}The label配合background's "Global Function Settings" and "Contact Information Settings" custom parameter function, brings great flexibility to Anqi CMS.It allows for the centralized and convenient management and invocation of much non-structured, global, or setting-specific information on websites.This not only liberates developers, but also gives operation personnel greater autonomy, allowing website content management to truly achieve 'do as one wishes'.


Frequently Asked Questions (FAQ)

Q1: Why should I use{% diy %}Labels to manage custom information, rather than hardcoding them directly into the template?

A1:Use{% diy %}The greatest advantage of using labels to manage custom information lies inFlexibility and maintainability. When this information needs to be updated, website operators can directly modify it in the Anq CMS backend without touching any code or redeploying the website.This greatly reduces the operating costs and risk of errors, especially suitable for those who need to adjust frequently or by non-technical personnel responsible for updates, ensuring the consistency and timeliness of website information.Hardcoded information means that each modification requires technical personnel to intervene and modify the template file, which is time-consuming and prone to errors.

Q2:{% diy %}Can a tag call rich text (HTML) content? If so, how can you ensure that the content is rendered correctly?

A2:Yes,{% diy %}Tags can call rich text content. When you enter content containing HTML tags in the custom parameters in the background (for example, text with bold, links, images, etc.), Anqi CMS will store it as a string.When calling such custom parameters in the template, you need to use|safeA filter to ensure that HTML content is correctly parsed by the browser and not displayed as plain text. For example:{{ diy_content|safe }}This is because AnQi CMS defaults to escaping output content to prevent XSS attacks,|safeThe filter explicitly informs the system that this part of the content is safe and can be output as is.

Q3: I see that custom fields can also be added in content models (such as articles, products), and the difference between these custom fields and{% diy %}the custom information called by tags is?

A3:They are all custom information, but the service scenarios and calling methods are different.{% diy %}Tags are mainly used for callingGlobal or setting classCustom information, which is usually related to the entire website or a specific functional area, such as the website slogan, customer service hotline, social media homepage link, etc. They are in the background "Global Function"

Related articles

`{% diy %}` label and the system built-in `{% system %}` or `{% contact %}` label what are the similarities and differences?

AnQi CMS as an efficient enterprise-level content management system, its template tag system provides great flexibility for content display.When building a website, we often need to fetch various data from the backend and display it on the frontend page.Among these, `{% system %}`, `{% contact %}`, and `{% diy %}` are all used to obtain information from the background configuration, but they have subtle differences in functional emphasis, data source, and application scenarios.Understanding these similarities and differences can help us use these tools more efficiently and rationally, creating a clear structure

2025-11-06

How to implement a custom global website title or subtitle display using the `{% diy %}` tag?

## How to cleverly use the `{% diy %}` tag of AnQi CMS: Create personalized global website title and subtitle Maintaining brand image consistency and content update flexibility is crucial in website operation.Especially the global title and subtitle of the website, which are not only the first impression visitors have of the website content, but are also key elements of search engine optimization (SEO).

2025-11-06

If the custom content information is not set on the backend, what will the `{% diy %}` tag return on the front end?

AnQiCMS (AnQiCMS) with its flexibility and powerful customization capabilities has become the preferred tool for many enterprises and content operators.The `{% diy %}` tag is the key to displaying dynamic content, allowing us to customize various information in the background and present it on the website front end.What if the backend does not set a specific custom content, and the front end uses the `{% diy %}` tag to call it?As an experienced website operations expert, I am happy to delve deeply into this mechanism.### Understand `{%

2025-11-06

Under AnQiCMS multi-site management, how to accurately call the custom content of a specific site using the `{% diy %}` tag?

In the powerful ecosystem of Anqi CMS, multi-site management is undoubtedly one of its core highlights, giving enterprises the ability to operate multiple brands or sub-sites on the same platform.However, in the process of content operation, we often encounter such needs: how to flexibly call specific custom content from another sub-site in the template of the main site?At this point, the `{% diy %}` tag, combined with its clever `siteId` parameter, has become our powerful assistant in achieving this goal.

2025-11-06

Can the custom parameter value obtained from the `{% diy %}` tag be directly used in conditional judgments within the template?

As an experienced website operations expert, I am well aware of the convenience and strength that AnQiCMS (AnQi CMS) brings to us in content management and website operations.Its flexible template engine and rich tag features make it possible to build and maintain websites efficiently.Today, let's delve deeply into a common problem encountered in template development: 'Can the custom parameter value obtained from the `{% diy %}` tag be used directly for conditional judgments in the template??

2025-11-06

How to implement dynamic loading of image URL and custom media resources with `{% diy %}` tag?

As an experienced website operation expert, I am well aware that the flexibility and customization of website content are crucial for maintaining competitiveness in the ever-changing online environment.AnQiCMS (AnQiCMS) with its efficient architecture based on the Go language and powerful features, provides us with a flexible content management platform.

2025-11-06

Does using the `{% diy %}` tag affect page loading speed or SEO?

In the daily operation of Anqi CMS, we often encounter questions about how template tags affect website performance and SEO effects.Today, let's delve into the usage of the `{% diy %}` tag and see if it really becomes a bottleneck for page loading speed or has a negative impact on search engine optimization.As an experienced website operation expert, I deeply understand that AnQiCMS, developed with high-performance architecture in Go language and rich SEO optimization tools as its core advantage, aims to provide an efficient and customizable content management solution. Therefore

2025-11-06

How to ensure that the custom content obtained by the `{% diy %}` tag is safely output in the front-end template?

As an experienced website operations expert, I know that the flexibility of the Content Management System (CMS) is both an advantage and may bring potential security challenges.AnQiCMS is widely popular among many enterprises and content operators for its simplicity, efficiency, and powerful customizability.One of its core functions is to obtain custom content from the background through the `{% diy %}` tag, which greatly enriches the dynamism of the template.However, how to ensure that these custom contents are safely output in the front-end template and avoid potential risks is a problem that every operator must seriously consider.

2025-11-06