It is crucial to maintain consistency and ease of updating in website operation and management.AnQiCMS as an efficient content management system fully considers this point, providing powerful built-in tag functions, allowing the global configuration information of the website (such as website name, Logo, filing number, etc.) to be easily obtained and displayed in the front-end template.This means you do not need to hard code, just make a change in one place in the background, and all pages referencing this information will be automatically updated, greatly enhancing the maintainability and operational efficiency of the website.
Understand AnQiCMS system configuration
AnQiCMS concentrates the core configuration information of the website in the background "Background Settings" -> "Global Function Settings" module. Here, you can manage and modify:
- Website Name: Used for page titles, brand identification, etc.
- Website Logo: Upload the visual logo image of the website.
- Website registration number: Information in accordance with legal requirements for filing.
- Copyright information: Usually displayed in the copyright statement at the bottom of the website page.
- Home Page AddressThe root domain or home page link of the website.
- Mobile end addressThe specific address for mobile device access (if enabled).
- Template static file addressConvenient for referencing CSS, JS, and other static resources.
- Site Language: The language setting of the current website.
- And pass through.Custom parameterFunction, you can add any additional configuration items according to the unique needs of your website, such as customer service phone number, company address, specific social media links, etc.
Central management of these configurations makes it very intuitive and efficient to control the global information of the website.
The core usage of system tags ({% system %})
In AnQiCMS template files, we mainly use{% system %}Label to retrieve this system information configured in the background. This label is very flexible and can be used in various ways according to your specific needs.
Basic syntax:
{% system with name="字段名称" %}
This method will directly output the value of the specified field. For example, if you want to display the website name directly on the page, you can do it like this.
Assign to a variable:
{% system 变量名称 with name="字段名称" %}{{ 变量名称 }}
If you want to reuse some configuration information in multiple places in the template, or need to process the obtained values further (such as concatenating with other text), assigning it to a variable would be a better choice, which can also improve the readability of the template code.
Under a multi-site environmentsiteIdparameters:
If you have enabled the multi-site feature in the AnQiCMS backend and want to retrieve configuration information for other sites in the current template, you can addsiteIdParameter to implement:
{% system with name="SiteName" siteId="2" %}
HeresiteId="2"Refers to the configuration information of the site with ID 2.
Common system configuration items and their calls in the template
Let's take a look at some common system configuration items and how they are passed through the template.{% system %}Tag acquisition and display.
1. Website name (SiteName)
This is the most basic identifier of the website, usually used in browser titles, page top navigation, etc.
- Example usage:
or assign to a variable:<title>{% system with name="SiteName" %} - 您的副标题</title>{% system siteName with name="SiteName" %} <h1>欢迎访问 {{ siteName }}</h1>
2. Website Logo (SiteLogo)
The website logo is an important part of the brand image. After uploading it on the backend, you can easily reference it in the template.
- Example usage:
Here we will assign the website name to{% system siteName with name="SiteName" %} <img src="{% system with name="SiteLogo" %}" alt="{{ siteName }}" class="website-logo" />siteNamethe variable as the logo image'saltThe attribute value, helpful for SEO and accessibility.
3. Website filing number (SiteIcp)
Domestic websites need to display the filing number, AnQiCMS makes this operation simple.
- Example usage:
<p class="icp-info"> <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank"> {% system with name="SiteIcp" %} </a> </p>
4. Copyright information (SiteCopyright)
The website footer often contains copyright statements, and tags can be used to flexibly manage this content.
- Example usage:“`twig <footer class