Building a website in AnQi CMS, basic information such as the website name, Logo, filing number, copyright information, and so on, is an important element that constitutes the overall style and professionalism of the website.This information often needs to be managed uniformly and flexibly called from all corners of the website.A security CMS provided for thissystemTags, it acts like a central console, allowing us to easily call and display these global configuration information.
UnderstandingsystemThe working principle of tags, first of all, it is necessary to clarify that this information is usually configured in the "Global Function Settings" of the AnQi CMS backend.Here, you can set the name of the website, upload the Logo image, fill in the filing number and copyright statement, and even define some custom global parameters.Once these settings are complete, the front-end template can be throughsystemTags to retrieve and display them.
systemThe basic usage of Tags is{% system 变量名称 with name="字段名称" %}. Here,变量名称Optional, if set, you can assign the data obtained to a temporary variable for subsequent reuse; if omitted, the tag will directly output the obtained content.name="字段名称"It is the key, it tells the system which specific global configuration item you want to call.
Let's take a look at how to go throughsystemLabel to call and display this common website global configuration information:
FirstlyWebsite Name. It usually appears in the title bar, navigation bar, or other prominent positions on a webpage, representing your brand.After configuring the "Website Name" in the "Global Feature Settings" backend, you can use it in the template.{% system with name="SiteName" %}To get. For example, place it in the HTML's<title>Tags within can effectively improve search engine optimization (SEO) effect.
Next isWebsite Logo. As the visual identity of the website, the display of the Logo is crucial. After uploading the Logo image on the backend, through{% system with name="SiteLogo" %}You can get its image address. You can embed it in the template like this:<img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />Here, we cleverly combine the Logo image with the website name as the alternative text (alt attribute), which improves accessibility and also benefits SEO.
Website registration numberIt is an embodiment of the compliance of domestic websites. The website registration number filled in the "Global Function Settings" can be accessed through{% system with name="SiteIcp" %}Call. It is often placed at the bottom of the website and linked to the MIIT filing query website, for example:<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a>.rel="nofollow"The attribute here reminds the search engine not to track this link,target="_blank"Then let the link open in a new window to maintain the user's experience on your website.
Copyright informationIt is usually displayed in the footer of a website, stating the copyright ownership of the website content. After filling in the relevant content in the "Global Function Settings" "Copyright Information" field in the background, you can use{% system with name="SiteCopyright" %}Get it. It is worth noting that if your copyright information contains HTML tags (such as©), in order to parse and display it correctly, you may need to use it in conjunction with|safefor example:<div>{% system siteCopyright with name="SiteCopyright" %}{{siteCopyright|safe}}</div>.
In addition to the core information mentioned above,systemtags can also help you access other important global settings, such as:
- The home page address (
BaseUrl) and the mobile address (MobileUrl)These are very useful when building internal links or handling mobile adaptation. - Static file address of the template (
TemplateUrl)When you need to reference CSS, JS, or other static resources in the current template directory,{% system with name="TemplateUrl" %}Can provide the correct path, for example:<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">. - Current template directory name (
TemplateName) and the closed station prompt content (SiteCloseTips): These can also be accessed throughsystemLabel acquisition, convenient for templates to dynamically adjust according to the current state or the template used. - Site language (
Language)In a multilingual website, this can be used to set the HTML'slangattribute, for example:<html lang="{% system with name='Language' %}">.
The strength of AnQi CMS lies in the fact that it allows you to add in the "Global Function Settings".Custom parameter. If you have special requirements, such as needing a universal help page link, you can add a custom parameter named 'HelpUrl' in the background and fill in the link address.In the template, you can use{% system helpLink with name="HelpUrl" %}{{helpLink}}To flexibly call this custom link.
For AnQi CMS deployment that supports multiple sites,systemthe tags also providesiteIdParameter. If you need to display global information from another site in a template on a site, just specify the target site in the tag.siteIdFor example{% system with name="SiteName" siteId="2" %}This allows for flexible cross-site information calls.
In summary,systemTags are a basic and powerful tool in the development of Anqi CMS templates.It seamlessly connects the background global configuration with the front-end display, allowing website operators to efficiently manage and update various general information of the website, whether it is brand image, legal statements, or functional links, all of which can be realized through unified control and display, thereby greatly enhancing the maintainability and user experience of the website.
Frequently Asked Questions (FAQ)
Question: Why did I pass through?
{% system with name="SiteCopyright" %}After calling the copyright information, if the content contains HTML tags (such as<br/>It will be displayed directly on the page, not parsed as a line break?Answer: This is because the Anqi CMS template engine defaults to escaping HTML entities for security reasons. If your copyright information indeed needs to include HTML tags, and you confirm that this content is safe, you can use it when calling it.|safeA filter to indicate that the template engine should not escape this content, for example:<div>{% system siteCopyright with name="SiteCopyright" %}{{siteCopyright|safe}}</div>.Ask: How can I call the value of a custom parameter named "Customer Service Phone" that I added in the "Global Function Settings" in the background?Answer: You can use
nameParameters to specify the custom parameter name. If your custom parameter name is "Customer Service Phone", then you can call it in the template like this:{% system customerPhone with name="客服电话" %}{{customerPhone}}Make sure thatnameThe value in the parameter is exactly the same as the custom parameter name you set in the background.Ask: Can I display the website name of another site in the template of a single site I have built with my Anq CMS?Yes, you can.
systemTag supportsiteIdParameters allow you to specify the target site ID for the information to be retrieved. For example, if you want to display the website name of the site with ID 2 on the current site, you can use it like this:{% system otherSiteName with name="SiteName" siteId="2" %}{{otherSiteName}}This will allow you to flexibly share and display global configuration information across multiple site environments.