Anqi CMS Template Tag Manual
-
System Settings Tags
Description: Used to obtain system configuration information. Usage: {% system variable_name with name="field_name" %}, the variable name is not required. After setting the variable name, it can be called by the variable name later. If the variable name is not set, the result is output directly. The available field names for the name parameter are: Website Name SiteName Website Logo SiteLogo Website -
Contact Information Tag
Description: Used to obtain contact information configured in the background. Usage: {% contact variable_name with name="field_name" %}, the variable name is not required. After setting the variable name, you can call it later by using the variable name. If the variable name is not set, the result is output directly. The available field names for the 'name' parameter are: Contact person UserNamePhone number Cellpho -
TDK Tag
Description: Used to obtain the title, keywords, and description information of a page. Usage: {% tdk variable_name with name="field_name" %}, the variable name is not required. If a variable name is set, it can be called by the variable name later. If no variable name is set, the result is output directly. The available field names for the name parameter are: Page Title - Tit -
Navigation List Tag
Description: Used to get the page navigation list Usage: {% navList variableName %} For example, if the variable is defined as navs {% navList navs %}...{% endnavList %}, it can also be defined with other variable names. After definition, the variable name needs to be consistent with the variable name used in the following for loop. -
Category List Tag
Description: Used to get the list of articles and product categories. Usage: {% categoryList variableName with type="1|2" parentId="0" %} For example, if the variable is defined as categories {% categoryList categories with type="1" parentId="0" %}. -
Category Details Tag
Description: Used to get the details of article categories and product categories. Usage: {% categoryDetail variableName with name="field name" id="1" %} Variable name is not required. After setting the variable name, it can be called by the variable name later. If the variable name is not set, the result is output directly. The parameters supported by categoryDetail are: id, id is not -
Document list tag
Description: Used to get document general list, related document list, document pagination list Usage method: {% archiveList variableName with categoryId="1" order="id desc|views desc" type="page|list" q="search keyword" %} If the variable is defined as archives {% a -
Document detail tag
Description: Used to obtain document detail data Usage method: {% archiveDetail variableName with name="field name" id="1" %} Variable name is not required. If the variable name is set, subsequent calls can be made using the variable name. If the variable name is not set, the result is output directly. Supported parameters of archiveDetail include: Document ID idid is not required. -
Document Tag List Tags
-
Tag Document List Tags
-
Single Page List Tag
Description: Used to get the list of pages. Usage: {% pageList variableName %} For example, if the variable is defined as pages {% pageList pages %}...{% endpageList %} The pageList tag does not support parameters, so it will fetch all the pages. -
Single Page Details Tag
Description: Used to obtain single page detail data Usage method: {% pageDetail variableName with name="field name" id="1" %} Variable name is not required. After setting the variable name, it can be called by the variable name later. If the variable name is not set, the result is output directly. The parameters supported by pageDetail are: id, id is not required, and the current single page will be obtained by default. -
Comment List Tag
Description: Used to get the document comment list, comment pagination list Usage method: {% commentList variableName with archiveId="1" type="page|list" %} If the variable is defined as comments {% commentList comments with archiveId="1" type= -
Message Form Tag
Description: Used to obtain the usage method of the guestbook form in the background. Usage: {% guestbook variable_name %} For example, if the variable is defined as fields: {% guestbook fields %}...{% endguestbook %} This tag does not support parameters. -
Breadcrumbs Navigation Tag
-
Previous document tag
Description: Used to get the method of using the previous document data. Usage: {% prevArchive variableName %} For example, if the variable is defined as prev, {% prevArchive prev %}...{% endprevArchive %} prevArchive does not support parameters. -
Next document tag
-
Tag Details Tags
-
Statistics Code Tag
JS automatic submission code call tag for 360/Toutiao and others: {{- pluginJsCode|safe }} -
Related document tags
Description: Retrieve related documents for the current document.The logic of the related documents is: according to the current document's document id, obtain the adjacent documents of the same category.Therefore, this tag can only be used on the document details page. -
Other Auxiliary Tags
Some commonly used built-in tags.The nested reference in templates, include is often used when creating templates. We will extract some common parts, such as header, footer, aside, etc., and store them independently. We do not need to rewrite them on every page; we just need to include them in each page.At this moment, we can use the include tag. -
Page Tag
-
Document parameter tags
-
Document parameter filter tags
The document parameter filter is only available on the document homepage or document category templates, combined with the document pagination list.Description: Used for creating filter conditions based on various parameters of a document, such as when creating a real estate website, you can filter by property type such as residential, commercial, or residential-commercial. You can also add filters based on property size such as single room, one bedroom one living room, two bedrooms two living rooms, three bedrooms two living rooms, etc. In this case, the document parameter filtering feature can be used. -
Friendship Link Tag
Description: Used to get the list of friend links Usage: {% linkList variableName %} For example, if the variable is defined as friendLinks {% linkList friendLinks %}...{% endlinkList %} linkList does not support parameters and will retrieve all friend links. -
More Filters
When outputting variables, it also supports using filters to perform initial data filtering, the format is: {{obj|filter__name:param}} For example, a variable outputs the current value when it has a value, and outputs the default value when it does not have a value: Use default to set the default value: {{ userName|default:"Anonymous Guest"}} default is empty -
General Tag - Variable Assignment Tag
iris.The Django template engine's template parser provides a method named `with` that allows declaring variables and using them in templates.We can temporarily declare one or more variables with, providing them for later use.In most cases, we would use it in conjunction with the include tag. -
Timestamp Formatting Tag
In the template, it supports direct formatting of timestamps into specified formats.Label keyword: stampToDate.Usage method: {{stampToDate(time stamp, "format")}}.Timestamp in 10 digits, such as 1609470335, in the format supported by Golang. -
General Tag - For Loop Traversal Tag
for used to iterate over each item in an array, making the item available in the context variable. -
General Tag - Remove Logical Tag Lines
This requirement is often used, such as in if-elseif statements or for loops, it will also output the blank lines of the if-else label part. If you want to clean up these blank lines, you can use - before or after the label to filter them out, like: {%- if false %} 1st choice {%- elif false %} 2nd choice -
General Tag - Arithmetic Operation Tag
Using mathematical arithmetic to calculate integer and complex expressions in templates {{ 10-100 }} {{ -(10-100) }} {{ -(-(10-100)) }} {{ -1 * (-(-(10-100))) }} {{ -1 * (-(-(10-100))) -
General Tag - if logic judgment tag
The value of the label judgment expression, if the expression evaluates to true, then execute its main content.Usage method: {% if condition %} ... {% endif %} , {% if condition %} ...If other conditions {% elif other conditions %} ... {% endif %} , {% if condition %} ... -
Message Verification Code Tag
Message Verification Code Tag -
Check if text or array contains a specified keyword
-
Remove all leading and trailing spaces, and specific characters from a string
How to remove leading and trailing spaces or specific characters from a string in the Anqi CMS template?The trim, trimLeft, and trimRight filters can respectively remove spaces at the beginning and end of a string, or specific characters. -
Calculate the number of times a keyword appears in a line string and in an array
How to calculate the number of times a keyword appears in a string or array in the AnQi CMS template?The `count` filter can calculate the number of times a keyword appears in a string or an array (array/slice). -
Filter: Split a line of text into an array by spaces
How to split a line of text into an array in AnQi CMS template?The fields filter can split a line of text into an array by spaces in the template.The defined array is a []string{}, which can be traversed and outputted later. -
Find the position of a keyword in a string or array row
How to get the position of a keyword in a line string or array in the Anqi CMS template?The index filter can calculate the position of a keyword in a string or array (array/slice).If a string contains multiple keywords to search for, the index returns the position of the first occurrence.If not found, return -1. -
Define an array in a template
How to define an array in the template of AnQi CMS?The list filter can be defined in the template.The defined array is a []string{}, which can be traversed and outputted later. -
Replace a specific keyword in a string with another keyword
How do I replace a word with another in a string in the AnQi CMS template?The replace filter can replace the old word with the new word in a string and return the new string.If old is empty, it will match at the beginning of the string and after each UTF-8 sequence.If new is empty, remove old. -
Specify repeated multiple output strings
How to repeat a string a specified number of times in the Anqi CMS template?The repeat filter can repeat a string a specified number of times. -
Generate random text
The lorem tag can generate random text content of specified length.Generally used for typesetting needs.Usage method: {% lorem 数量 方法 random %} The number can be calculated by characters or words, depending on the method.The method is one of the following: 'w', 'p', or 'b'. -
Add numbers or strings
Filter: Add Numbers or Strings -
Add a backslash before predefined characters
-
Convert English string letters to uppercase or lowercase
How to convert English string letters to uppercase or lowercase in AnQi CMS template?The `capfirst` filter can convert the first letter of an English string to uppercase.Only English letters will be converted.The lower filter can convert all letters in a string to lowercase.The upper filter can convert all letters in a string to uppercase. -
Center, left-justified, and right-justified string display by specified length
-
Remove specified characters from any position in a string
How to remove a specified character from any position in a string in the Anqi CMS template?The cut filter can remove the specified character from any position in a string. -
Display time values in specified format
How to display time values in a specified format in the AnQi CMS template?The date filter can display time values in a specified format.But note that the input for date must be a time.Time value; otherwise, it cannot be processed and an error will be reported.Output format is set according to the Golang time format.You can also use time, it has the same usage and result as date. -
Set default value for number, string, or object
How to set default values for numbers or strings, or objects without values in the Anqi CMS template?The default filter can set a default value for numbers or strings, or objects when there are no values.The 'default_if_none' filter can determine if a pointer-type object is empty, and if it is, it sets a default value. -
Determine if a number can be a dividend
How to judge whether a number or its calculation result can be used as a divisor in an AnQi CMS template?The `divisibleby` filter can determine if a number or its calculation result can be a dividend.The filter will return a boolean value (bool), True means yes, False means no. -
Escape special characters in a string or JavaScript code
-
Split a line of text into an array by spaces
How to split a line of text into an array in AnQi CMS template?The fields filter can split a line of text into an array by spaces in the template.The defined array is a []string{}, which can be traversed and outputted later. -
The first or last value of a string or array
How to get the first or last value of a string or array in the AnQi CMS template?first Filter can get the first character of a string or the first value of an array.If the original string or array is empty, nothing is returned.If the string is Chinese, return the first Chinese character.The last filter can get the last character of a string or the last value of an array.If the original string or array is empty, nothing is returned. -
Decimal numbers are rounded to a specified number of decimal places
How to output a floating-point number with 2 decimal places in the Anqi CMS template?The floatformat filter can output a floating-point number with 2 decimal places.Also, you can retain the specified number of decimal places.As for retaining decimal places up to 3.Supports negative number of digits. If a negative number is set, it is calculated from the last digit forward. -
Get the number at a specified position in a number
How to get a specific number from a number in the AnQi CMS template?The 'get_digit' filter can obtain the digit at the specified position within a number, with the position counted from the end of the number, starting from 1.If the location to be obtained does not exist, return the entire number.If the original number is a number, the result obtained is the number obtained by subtracting 48 from the ASCII value of the character at that position. -
Convert a number string to a floating-point number or integer
How to convert a numeric string to a floating-point number or an integer in the AnQi CMS template?The float filter can convert a numeric string to a floating-point number.If the conversion fails, 0.0 is returned.integer Filter can convert string numbers to integers.If the conversion fails, it returns 0. -
Join array elements into a string with a specified separator
-
Get the length of a string, array, or key-value pair
How to get the length of a string, array, and key-value pair in AnQi CMS template?The length filter can obtain the length of strings, arrays, and key-value pairs.For strings, calculate the actual character count of its UTF-8 representation, with each letter and each Chinese character counting as one.Calculate the number of indices for arrays and key-value pairs. -
Convert multi-line text to HTML tags with newline characters
How to convert multi-line text into HTML tags in AnQi CMS template?The linebreaks filter can convert multi-line text into HTML tags with line breaks.Every line should be wrapped with and, and there should be a blank line in the middle.The content can be processed using linebreaksbr. -
Translate mobile phone numeric keypad letters to numbers
How to convert the mobile phone number keypad letters to numbers in the Anqi CMS template?phone2numeric filter can convert letters on the mobile phone keypad to numbers. -
Plural form of a word
-
Return a random character from a string, array, or value
How to return a random character from a string or array in Anqi CMS template?The random filter can return a random character or value from a string or array. -
Remove HTML tags from HTML code
How to remove tags from HTML code in the AnQi CMS template?The `striptags` filter can remove all HTML tags from the HTML code.The 'removetags' filter can remove specified tags from HTML code. -
Parse and output HTML code without escaping
-
Extract an element from a string or array at a specified position
-
Split a string into an array by a specified delimiter
How to split a string with a specific format into an array using a specified delimiter in the AnQi CMS template?The split filter can divide strings of a specific format into an array by a specified delimiter.If the delimiter does not exist in the string, an array of length 1 will be returned, with the value being the string itself.If the delimiter is empty, the array will be split by each UTF-8 character. -
Format any value into a string and output it
How to format any value such as number, string, array, etc. into a string with a specified format in the Anqi CMS template?The stringformat filter can format numbers, strings, arrays, and other arbitrary values into strings according to a specified format. -
Extract strings or HTML code and add...
How to cut and add strings or HTML code in Anqi CMS template?The truncatechars filter can truncate and append strings... This method will truncate words, including the specified length...The `truncatechars_html` filter can truncate and append to HTML code ..., this method will truncate words, including the specified length ... -
URL parameter escaping
How to escape URL parameters in Anqi CMS template?The urlencode filter can escape URL parameters.The iriencode filter can escape URL parameters, except for /#%[]=:;$_&()+,!?All other characters, including `@'~`, will be escaped according to the URL parameter escaping scheme. -
Find and parse URL strings in text into clickable a tags
-
Count the number of words in a string
How to calculate the number of words in a string in AnQi CMS template?The wordcount filter can calculate the number of words in a string.word count will be separated by spaces.If it does not contain any spaces, it is considered a word.Returns an integer. -
Automatic line breaking for long text
-
Three states: OR, AND, NOT
-
User Details Tag
Description: Used to obtain user detail data Usage: {% userDetail variableName with name="field name" id="1" %} The variable name is not required. After setting the variable name, it can be called through the variable name later. If the variable name is not set, the result is output directly.userDetail supports the following parameters: user ID id. -
User Group Details Tag
Description: Used to obtain user group detail data Usage: {% userGroupDetail variableName with name="field name" id="1" %} The variable name is not required. After setting the variable name, it can be called through the variable name later. If the variable name is not set, the result is output directly.The supported parameters for userGroupDetail are: user group ID id. -
Home Banner List Tag
-
Document Model Detail Tag
Description: Used to obtain detailed data of the document model Usage: {% moduleDetail variableName with name="field name" id="1" %} Variable name is not required. If a variable name is set, subsequent calls can be made through the variable name. Without setting a variable name, the result is output directly.moduleDetail Supported parameters: model ID id.id is not required, it will get the current model by default.If you need to specify a model, you can achieve this by setting id or token. -
Template text translation tag
Explanation: Used for translating specified text in the template.Usage method: {% tr variable name %} The prerequisite for using the translation field is that the template supports multi-language functionality.The method to enable multi-language function in the template is as follows: Create a directory named 'locales' under the template directory, and then create a folder with the name of the current language code, such as 'zh-CN' or 'zh-TW'.Create a yml file in the folder, for example, default.yml. -
Get multi-language site list tag
Description: Used to get the list of multilingual sites. Usage: {% languages variable_name %} For example, if the variable is defined as websites {% languages websites %}...{% endLanguages %} languages does not support setting parameters. languages will retrieve all multilingual sites. -
dump filter: Print the structure type and value of variables
How to view the structure type of variables in AnQi CMS template?The dump filter can print out the structure, type, and value of a variable. -
Custom Content Tag
Description: Used for custom content information in the background. Usage: {% diy variable_name with name="field_name" %}, variable_name is not required. After setting the variable name, you can call it through the variable name later. If the variable name is not set, the result is output directly. diy supports parameters such as siteId, siteId, siteId - Generally, it is not necessary to fill in. If you use multi-site management in the background to create multiple sites and want to call data from other sites, you can specify siteId -
Json-LD Custom Call Tag
Json-LD is a data format for describing web content, using JSON to represent data and a specific syntax to describe web content.The backend feature has enabled the structured data function, and by default, it will insert a tag named -ld into the page, which contains structured data.If you want to have more control over the content of Json-LD, you can use the tag {% Ld %} ...【en】{% endLd %}.