Security BLOG

AnQiCMS Help Document and User Guide

What are the differences in the truncation logic of the `truncatewords` and `truncatechars` filters when truncating the abstract of an AnQi CMS article?

In Anqi CMS, in order to display the article summary on the list page or preview area, we often need to truncate the article content.At this time, the `truncatewords` and `truncatechars` filters come into play.They all can help us to shorten long content, but there are significant differences in the truncation logic between them, especially in handling Chinese and English characters and words, where their performance is even more disparate.Understanding these differences can help us better control the presentation of the summary.

📅 November 8, 2025 👁️ 60

How to safely use the `truncatechars_html` filter in Anqi CMS template to truncate HTML rich text content and automatically close tags?

In website content operation, we often need to display the partial content of articles, products, or single pages on list pages, abstract areas, or specific blocks.This content is often rich text that includes HTML tags. Simply truncating by character count may cause the HTML tags to be cut off, thereby破坏页面布局和显示效果.For example, a `<p>This is a paragraph<strong id=“test”>bold</span>` content that is abruptly truncated may cause the page to display unclosed tags.

📅 November 8, 2025 👁️ 66

How to format Unix timestamp to 'YYYY-MM-DD HH:MM' and other localized date strings using the `stampToDate` filter in AnQi CMS?

In website content management, the display of date and time information is ubiquitous.Whether it is the publication time of the article, the listing date of the product, or the submission time of the comments, a clear and readable date format is crucial for improving user experience.AnQiCMS (AnQiCMS) fully understands this need and provides powerful template tags and filters, among which the `stampToDate` filter is a powerful tool to convert the original Unix timestamp into a localized date string that we are familiar with.This article will delve into the usage of the `stampToDate` filter

📅 November 8, 2025 👁️ 65

In addition to `stampToDate`, how can the `date` filter of Anqi CMS implement custom date and time formatting when handling `time.Time` type?

In Anqi CMS, the display of dates and times often needs to be adjusted flexibly according to the actual needs of the website.We all know that the `stampToDate` filter is very convenient for handling Unix timestamps, as it can easily convert a string of numeric timestamps into the date format we need.But sometimes, the date value we handle in the template may already be a `time.Time` type object in Go language, rather than the original timestamp.In this case, Anqi CMS provides another powerful tool, that is `date`

📅 November 8, 2025 👁️ 68

How to use the `divisibleby` filter in AnQi CMS template to achieve alternate row coloring or group output every N elements?

In website operation, a well-designed page layout and content display can significantly improve user experience and readability.Especially in scenarios with a long list of items, if all entries are presented in the same style, it is easy to cause visual fatigue.At this time, alternating line colors or grouping by a specific quantity can well solve these problems.

📅 November 8, 2025 👁️ 62

How to use the `length_is` filter in an Anqie CMS template to validate the length of user input or data lists and return a boolean value for conditional rendering?

In Anqi CMS template development, flexibly controlling the display method of content is the key to improving website user experience.Among them, the `length_is` filter is a very practical tool that can help us easily check the length of user input or data lists in templates and conditionally render based on the check results.The core function of the `length_is` filter is to determine whether the length of a variable (whether it is a string, array, or mapping) is equal to a predefined value.It does not directly return the specific length value

📅 November 8, 2025 👁️ 61

The `length` filter calculates the length of Chinese string in an AnQi CMS template, is it counted by bytes or characters? How does it affect the output?

In AnQi CMS template development, dealing with string length is a common requirement.When dealing with multilingual content, especially when it includes Chinese characters, how a string's length is calculated in bytes or characters can directly affect the accuracy of template output and the presentation of the content.The `length` filter used in the Anqi CMS template is designed to solve this problem.It counts the length of the string by characters rather than by bytes.This means, whether it is an English letter

📅 November 8, 2025 👁️ 64

How to use the `get_digit` filter to extract a specific digit from a long numeric ID and display or perform logical operations in an Anqi CMS template?

In the development of Anqi CMS templates, we sometimes encounter situations where we need to extract a certain number of digits from a long numeric ID.For example, you may want to assign different styles to content based on some number of the ID, or make some logical judgments.At this time, the `get_digit` filter can be used.It provides a concise and efficient way to achieve this goal, making your template logic more flexible.

📅 November 8, 2025 👁️ 68

In the Anqi CMS template, what is the difference between the `default` and `default_if_none` filters when the variable is `nil` or empty?

During the template creation process of AnQi CMS, flexibly using variables and their default values is the key to improving the robustness and user experience of the template.When you are dealing with a variable that may not exist (`nil`) or is empty, the `default` and `default_if_none` filters are the tools you commonly use.Although they can all provide an alternative output when the variable 'no value' occurs, their criteria for determining 'no value' are subtle and important.To understand the difference between the two

📅 November 8, 2025 👁️ 65

The `stringformat` filter supports which formatting verbs in Go? How to choose the most suitable output format in AnQi CMS template?

In Anqi CMS template, the precise display of data is a key factor in improving user experience and website professionalism.The `stringformat` filter is exactly such a tool, allowing us to format various types of data in a highly flexible way to meet diverse front-end display requirements.It draws inspiration from the powerful `fmt.Sprintf` syntax in Go language, allowing developers and content operators to accurately control the format of the output content.###

📅 November 8, 2025 👁️ 63