Security BLOG

AnQiCMS Help Document and User Guide

How to ensure that the AnQiCMS template does not cause page rendering errors when the variable is `nil`?

When building a website with AnQiCMS, we often encounter the situation where template variables may be empty (`nil`).For example, a document may not have a thumbnail set or a custom field may not be filled in.If the template code does not properly handle these potential null values, errors may occur during page rendering, affecting user experience and even causing some website functions to be unavailable.Fortunately, the AnQiCMS template engine provides various mechanisms to help us elegantly handle the cases where variables are `nil`, ensuring the stability and smoothness of the page

📅 November 9, 2025 👁️ 69

In AnQiCMS template, which filters or tags behave in three states of 'or and not' logic for `nil` values?

In AnQiCMS template development, efficiently and robustly handling data is the key to building dynamic websites.Especially when the data obtained from the backend may contain `nil` (empty) values, it is particularly important to elegantly display content, provide default values, or execute specific logic in the template.AnQiCMS provides various filters and tags that can help us display three states of existence, non-existence, or undefined for `nil` values, thereby enhancing the flexibility and user experience of templates.### One, directly judge whether the data exists: `if`

📅 November 9, 2025 👁️ 70

What does the `stringformat` filter return when it fails to handle formatting in the AnQiCMS template?

AnQiCMS (AnQiCMS) boasts its efficient architecture based on the Go language and flexible template engine, bringing great convenience to content management.In daily content operation, we often need to present data in a specific format on the website front-end, which cannot do without various practical template filters.The `stringformat` filter is a powerful tool for data formatting, allowing us to format numbers, strings, and even more complex data types in a precise way, similar to the `fmt.Sprintf` function in the Go language.Understand

📅 November 9, 2025 78

How to display the detailed structure, type, and value of the `dump` filter in AnQiCMS template debugging?

During the development and maintenance of AnQiCMS templates, we often encounter situations where we need to confirm the content of variables.Improper use of template tags or an unexpected data structure passed from the backend can lead to page display errors.If you can see the internal structure, type, and current value of a variable at this time, it will undoubtedly greatly improve our debugging efficiency.In the AnQiCMS template system, the `dump` filter was born to solve this pain point, it's like a periscope, helping us to understand the 'inner nature' of template variables.### The pain points of template debugging and

📅 November 9, 2025 👁️ 64

What is the result of repeatedly outputting an empty string in the `repeat` filter of AnQiCMS templates?

AnQiCMS's template system is renowned for its concise and efficient Django-style syntax, which allows content developers to easily build dynamic pages.In daily template development, we often use various filters to process and format data.Among them, the `repeat` filter is a very practical tool that can repeat a string according to the specified number of times.However, when using the `repeat` filter, some developers may encounter a seemingly simple but easily confusing problem: when

📅 November 9, 2025 👁️ 68

How does the `split` filter handle empty strings or strings without the specified delimiter in AnQiCMS templates?

In AnQiCMS template development, string processing is a common requirement.Sometimes we need to split a string containing multiple values into individual items so that they can be traversed on the page for display or further processing.At this time, the `split` filter has become a powerful assistant for template developers.It can split a string into an array (or slice) based on a specified delimiter, greatly simplifying the logic of complex data display.However, some specific scenarios when using the `split` filter may confuse developers who are new to the field

📅 November 9, 2025 👁️ 62

How to use the `join` filter in AnQiCMS template to handle empty arrays or arrays with a single element?

In AnQi CMS template development, the flexibility of data display is crucial.We often need to present the data list obtained from the backend in a beautiful and consistent manner on the front-end, which includes the need to concatenate the elements of an array (or list) into a string.The AnQi CMS template engine provides a powerful `join` filter, which not only handles common arrays containing multiple elements but also demonstrates its unique and practical behavior in special cases such as empty arrays or arrays containing only a single element.The `join` filter is a very practical tool in the Anqi CMS template

📅 November 9, 2025 👁️ 74

How to judge whether an array or string is empty in AnQiCMS template using the `length` filter?

In Anqi CMS template development, we often need to decide the display content of the page based on the existence or absence of data, for example, a list of articles. If the list is empty, we may need to display "No content" instead of a blank area.At this time, the `length` filter becomes our powerful assistant, which can help us easily judge whether arrays, strings, and other data are empty.### Getting to know the `length` filter The `length` filter is a very practical feature provided by the Anqi CMS template engine

📅 November 9, 2025 👁️ 70

How to ensure the correct setting of the `hreflang` tag in the `languages` label of the AnQiCMS multilingual site?

Today, with the deepening of globalization, many enterprises and content operators need to provide customized content for users of different languages or regions.To ensure that these multilingual versions can be correctly identified and displayed to target users, the proper setting of the `hreflang` tag is particularly important.For friends using AnQiCMS to build multilingual websites, the built-in `languages` tag is the powerful tool to solve this problem.Understanding the importance of the `hreflang` tag To delve deeper into

📅 November 9, 2025 👁️ 67

How to safely embed third-party statistics or advertising JS code in AnQiCMS templates?

In website operation, we often need to rely on third-party statistical tools to analyze visitor behavior, or to generate income through advertising platforms.Embed these third-party JavaScript (JS) codes securely and efficiently into website templates is a skill that every website operator needs to master.For those using AnQiCMS, understanding its template mechanism and built-in features can help us complete this task more securely.AnQiCMS is an enterprise-level content management system developed based on the Go language, which has always paid close attention to performance and security in its initial design

📅 November 9, 2025 👁️ 72