AnQiCMS Help Document and User Guide
In website operations, we often need to summarize long content to attract users to click and view the details.However, directly truncating rich text content containing HTML tags often leads to page structure chaos, for example, a `<p><b>important information</p>` truncated to `<p><b>important` such a missing tag, not only ruins the visual beauty of the page, but may also lead to the entire page layout disorder.This is undoubtedly one of the most headache issues for content operators. AnQi CMS understands this pain point.
When using AnQiCMS to manage website content, we often encounter such a scenario: to make the article content more beautiful in layout, various HTML tags are used to enrich the visual effects, such as paragraphs (`<p>`), images (`<img>`), links (`<a>`), bold (`<strong>`), and so on.However, on the article list page or in the related recommendation module, we often need to display the abstracts or parts of these articles, but we cannot directly display the entire long discourse. At this time
In AnQi CMS template development, in order to better display content summaries or control page layouts, we often need to truncate text.At this moment, the `truncatechars` and `truncatewords` filters come into play.They can all help us shorten long texts and add an ellipsis at the end, but there is an essential difference in their truncation logic. Understanding these differences is crucial for choosing and using them correctly.
In AnQi CMS template design, in order to ensure the beauty of the page and the uniformity of the layout, we often need to truncate the article title and automatically add an ellipsis after truncation.AnQiCMS provides a simple and efficient template filter to meet this requirement, making content display more flexible.
In the daily content operation of AnQi CMS, the tags (Tag) submitted by users often face a common problem: the format is not unified.Some users are accustomed to separating with commas, some with semicolons, and even possibly with Chinese commas or even just spaces.These irregular inputs, if directly displayed on the website front-end, not only affect the aesthetics but may also reduce the usability of tags, for example, causing trouble when generating tag clouds or performing SEO optimization.
In website content operation, we often need to display a series of related information in the form of a list to users, such as all tags of an article, multiple characteristics of a product, or a set of image URLs.AnQiCMS's template system usually provides these data in the form of a dynamic array (or sometimes called slices, lists).
In AnQi CMS template development, it is often encountered that a string needs to be split into multiple parts for further processing or dynamic display.To meet this requirement, AnQiCMS template engine provides two very useful filters, `make_list` and `split`.Although they can both convert strings to arrays, there are obvious differences in their core functions, splitting logic, and applicable scenarios in actual use.Understanding these differences can help us handle content more efficiently and accurately.
In AnQi CMS template development, the `split` filter is a very practical tool that can help us split strings into arrays according to the specified delimiter, which is very convenient when dealing with list data, tag content, or any structured text.However, when the delimiter is an empty string or does not exist in the target string, the behavior of the `split` filter shows some clever characteristics, understanding these characteristics is crucial for precise template control and avoiding potential errors.
In AnQiCMS (AnQiCMS) daily content operations, we often need to display related keywords on articles or product detail pages.These keywords not only help search engines understand the content of the page, but also guide users to discover more relevant information.In most cases, we will enter these keywords in a text box on the backend, separated by commas, for example: "website operation, SEO optimization, content marketing.
In the world of AnQi CMS templates, flexible data handling is the key to improving website user experience and SEO performance.Sometimes, we need to extract a specific part from a long URL, such as path parameters, product ID, or simply display a part of the URL to keep the page concise.At this time, the `slice` filter is an extremely useful tool that can help us accurately cut any segment of a string or array.