As an experienced security CMS website operations person, I am well aware of the importance of website global configuration information, such as website name and logo, for the unified display of brand image and user recognition.In AnQi CMS, these core information is unifiedly managed, and through a concise and efficient template tag mechanism, it allows operators to easily call and display on various pages of the website.
Management of website global configuration information in AnQi CMS
AnQi CMS centralizes the global configuration information of the website in the "Global Function Settings" module of the background.These settings include the website name, Logo image, filing number, copyright information, and various basic addresses of the website (such as the homepage address, mobile version address, etc.).Through this unified interface, you can conveniently modify and manage these key information, ensuring that the website presents a consistent brand image and basic data across different access scenarios.
In addition to the system's preset configuration items, Anqicms also provides the function of custom parameters.This means you can add any custom fields you need according to specific operational requirements, such as the company's social media links, customer service phone numbers, etc.These custom parameters can also be flexibly called through template tags, greatly enhancing the customization capabilities of the template.
Core tag for calling system global configuration information in the template
In the template system of Anqi CMS,systemTags are special tools used to call these global configuration information. It allows you to quickly obtain and display the corresponding values by specifying the name of the configuration item.
Syntax of calling:
{% system 变量名称 with name="字段名称" %}
Among them:
变量名称: is an optional parameter, used to assign the obtained value to a temporary variable for repeated reference in the template or for logical judgment.If not specified, the label will output the corresponding value directly.name="字段名称"The parameter is required, used to specify the name of the configuration item you want to retrieve. These names correspond to the English identifiers of each configuration item in the background "Global Function Settings".
The display of the website name
The website name is the face of the website, usually appearing on the<title>Tags, header navigation, and footer copyright statements. By usingsystemLabel, you can easily display it in the template.
For example, to display the website name in the page title and combine it with the page's own TDK (Title, Description, Keywords) tags, it is usually usedtdkLabels are used to manage them whiletdklabel'sTitleFields can be configured to add or not add the site name suffix.
<title>{% tdk with name="Title" siteName=true %}</title>
This code will intelligently obtain the title of the current page and based onsiteName=trueThe setting, automatically appends the website name configured in the background "Global Feature Settings" to the end of the title.
If you only need to display the website name independently at a certain position on the page (such as the footer), you can call it like this:
<div>欢迎访问:{% system with name="SiteName" %}</div>
Or assign it to a variable:
{% system currentSiteName with name="SiteName" %}
<div>当前网站名称是:{{ currentSiteName }}</div>
Calling and displaying the website logo
The website logo is the core element of brand visual recognition. In Anqi CMS, you can upload Logo images on the backend and throughsystemLabel its path and then embed it in the HTML<img>in the tag.
For example, to display the logo image at the top of the website:
<a href="{% system with name="BaseUrl" %}">
<img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
</a>
This code not only calls the URL of the Logo image, but also cleverly utilizesSiteNameAs an imagealtattribute values, which are crucial for search engine optimization (SEO) and accessibility.BaseUrlMake sure that clicking the logo will correctly jump to the homepage of the website.
Calling other commonly used global configuration information.
In addition to the website name and Logo, there are many other global configuration information that is very useful in the template:
- Website filing number (
SiteIcp): It is usually displayed in the website footer and can link to the record query platform.<p> <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a> </p> - Copyright content (
SiteCopyright)Used to display the website copyright statement.
Here to use<div>{% system with name="SiteCopyright"|safe %}</div>|safeThe filter is because the copyright information may contain HTML entities or tags, to prevent them from being escaped. - The home page address (
BaseUrl)Used to build an absolute link, ensuring that the home page can be correctly returned on any page.<a href="{% system with name="BaseUrl" %}">网站首页</a> - Static file address of the template (
TemplateUrl)It is very useful when referring to the CSS, JavaScript, or other static resources built into the template.
It ensures that even after the website is deployed in a subdirectory or CDN, the static resource paths can be correctly resolved.<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet"> <script src="{% system with name="TemplateUrl" %}/js/main.js"></script> - Site language (
Language)Used to set the language attribute in HTML tags, which is helpful for international websites and search engines to understand the page language.<html lang="{% system with name='Language' %}">
Call custom global parameters
If you add a custom parameter in the background "Global Feature Settings", such as a parameter named "Hotline" (hotline), you can also usesystemTag to call it:
<div>客服热线:{% system with name="Hotline" %}</div>
This will directly output the value you have set for the 'Hotline' field in the background.
**Practice and Precautions
- Uniformity: Unify these global configuration information in the background management, and through
systemLabel call can ensure that the website maintains high consistency in both visual and content.Once the configuration changes, it only needs to be modified once in the background, and all calls to the tag on the entire site will be automatically updated, avoiding the麻烦 and potential errors of manually modifying the template file. - Ease of maintenanceThis calling method makes the template code more concise and readable, separating content from display logic, which improves the maintenance efficiency of the website.
- SEO-friendlyProperly use the website name as the logo.
altText, setting the website language properties, ensuring that the filing information is displayed, and other factors can help improve the website's SEO performance. - Caching considerationsIn some cases, especially for static resources such as logo images, if the latest version is not displayed on the front end immediately after the update, it may be necessary to clear the browser cache or CDN cache.For the cache of the Go program itself, the "Update Cache" feature of the Anqi CMS backend can help refresh the data at the system level.
- Multi-site compatibilityIf you have enabled the multi-site management feature of Anq CMS and need to call the configuration information of a specific site (not the current site),
systemTags also supportsiteIdThe parameter allows you to precisely control the source of the data you obtain.
By mastering the use ofsystemTags and the "Global Function Settings" on the backend allow you to efficiently manage and display the core information of the website, providing users with a consistent and professional browsing experience.
Frequently Asked Questions (FAQ)
1. Why did the Logo on the website's front page not update after I modified it in the "Global Function Settings" on the backend?This is usually due to browser cache or CDN cache.You can try clearing the browser cache, or if the website uses a CDN service, you also need to refresh the CDN cache.In addition, the 'Update Cache' feature of the Anqi CMS backend can also help refresh the system-level data cache.
How to add some global information that is not in the system default settings, such as the company's Facebook homepage link?You can find the 'Custom Parameter Settings' area on the 'Global Function Settings' page in the Anqi CMS backend.Click to add custom parameters, fill in the parameter name (such as 'FacebookUrl'), parameter value (your Facebook homepage link), and remarks.After saving, it can be used in the template{% system with name="FacebookUrl" %}Call the Facebook link you have set.
3. Can I call another site's Logo or website name in a template of a site in a multi-site secure CMS environment?Can.systemThe tag supports an optional parametersiteId. If you know the target site ID (which can be viewed in the background "Multi-site Management"), you can call it in the template like this: {% system with name="SiteLogo" siteId="目标站点ID" %}Thus, retrieve and display the Logo of the specified site.