How to get the global configuration information of AnQiCMS template, such as the website name and logo?

Calendar 👁️ 66

In AnQiCMS template, cleverly obtain the global configuration of the website to make your website more flexible

When designing or maintaining the AnQiCMS website template, we often encounter a need to display unified global information on various pages of the website, such as the name of the website, logo, filing number, or custom contact information, etc.Manually adding this information to each page is not only inefficient, but it also takes a lot of time and effort to update once it needs to be modified.systemTags, allowing you to easily access these global system configurations in templates, thereby building more flexible and easy-to-maintain websites.

Core Method: System Tags(systemTag)

AnQiCMS template uses a syntax similar to the Django template engine, for accessing global configuration information,systemTags are your core tool. It can directly access the various data you configure in the background "Global Feature Settings".

systemBasic usage of tags

systemThe general syntax of the tag is very intuitive: you can specifynameparameters to get specific configuration items.

{% system 变量名称 with name="字段名称" %}

here,变量名称It is optional, you can omit it if you want to output the result directly inside the tag; you can define one if you want to assign the obtained value to a variable for later use变量名称.字段名称The English identifier of the specific configuration item you want to get.

Next, let's see how to use this tag with some common examples:

To get the website name (SiteName)

The website name is an indispensable identifier for each website. In the AnQiCMS background "Global Function Settings", the "website name" you set can be accessed throughSiteNameThis field name is used to obtain.

{# 直接输出网站名称 #}
<h1>{% system with name="SiteName" %}</h1>

{# 将网站名称赋值给一个变量,然后使用 #}
{% system siteName with name="SiteName" %}
<p>欢迎来到 {{ siteName }}!</p>

Get the website logo (SiteLogo)

The website logo is also a key element of the brand image of the website. The address of the website logo image uploaded in the "Global Function Settings" can be obtained throughSiteLogothe field.

{# 直接输出网站LOGO,同时利用网站名称作为图片的alt属性,有利于SEO #}
<img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />

{# 将LOGO图片地址赋值给变量,并结合网站名称 #}
{% system siteLogo with name="SiteLogo" %}
{% system siteName with name="SiteName" %}
<a href="/">
    <img src="{{ siteLogo }}" alt="{{ siteName }} Logo" />
</a>

Other commonly used global information

Besides the website name and LOGO,systemtags can also get many other useful global configurations:

  • Website filing number (SiteIcp):
    
    <p><a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a></p>
    
  • Copyright content (SiteCopyright)This is usually used at the bottom of the website to display copyright statements. If the copyright information in the background contains HTML tags (such as links), remember to use|safeA filter that allows the template to render HTML correctly rather than outputting it as plain text.
    
    {% system copyrightInfo with name="SiteCopyright" %}
    <p>{{ copyrightInfo|safe }}</p>
    
  • The home page address (BaseUrl):
    
    <a href="{% system with name="BaseUrl" %}">返回首页</a>
    
  • Static file address of the template (TemplateUrl)This is very useful, it points to the current template folder./public/static/Directory, convenient for you to introduce CSS, JavaScript and other static resources.
    
    <link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">
    <script src="{% system with name="TemplateUrl" %}/js/main.js"></script>
    
  • Site language (Language): Get the language code of the current site, commonly used in HTML'slangProperty.
    
    <html lang="{% system with name='Language' %}">
    

Custom parameter: Extend your configuration

AnQiCMS's 'Global Function Settings' also allows you to add custom parameters.This means you can create any global configuration item according to your specific needs.For example, you may want to add a "WeChat customer service number" or "online customer service link" and call it in the template.

  1. Add custom parameter in the backgroundEnter the "Backend Settings" -> "Global Function Settings" page of the AnQiCMS backend. At the bottom of the page, find the "Custom Setting Parameters", click "Add Custom Parameter", and fill in the parameter name (for exampleWechatServiceNo) and parameter value.

  2. Call custom parameters in the template. Once saved, you can usesystemtags, to get their values by the parameter names you define.

    {# 假设您在后台自定义了一个名为 "WechatServiceNo" 的参数 #}
    <p>微信客服:{% system with name="WechatServiceNo" %}</p>
    
    {# 假设您自定义了一个名为 "AnalyticsCode" 的参数,通常会包含HTML/JS代码 #}
    {% system analyticsScript with name="AnalyticsCode" %}
    {% if analyticsScript %}
    {{ analyticsScript|safe }}
    {% endif %}
    

Applied: Build website header and footer

BysystemTags, you can easily build common website modules such as headers and footers, ensuring that the content of these modules remains consistent throughout the site.

{# partial/header.html #}
<header class="site-header">
    <div class="container">
        <div class="logo">
            <a href="{% system with name="BaseUrl" %}">
                <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
            </a>
        </div>
        <nav class="main-nav">
            {# 导航列表通常使用navList标签,这里仅作示意 #}
            <ul>
                <li><a href="{% system with name="BaseUrl" %}">首页</a></li>
                {# ... 其他导航项 ... #}
            </ul>
        </nav>
    </div>
</header>

{# partial/footer.html #}
<footer class="site-footer">
    <div class="container">
        <p>{% system copyrightInfo with name="SiteCopyright" %}{{ copyrightInfo|safe }}</p>
        <p>备案号:<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a></p>
        <p>联系电话:{% contact with name="Cellphone" %}</p>
        <p>网站地址:<a href="{% system with name="BaseUrl" %}">{% system with name="BaseUrl" %}</a></p>
    </div>
</footer>

Then simply include these common segments in your page template:

{% include "partial/header.html" %}

<main class="site-content">
    {# 页面具体内容 #}
</main>

{% include "partial/footer.html" %}

This way, whether you need to modify the website name, logo, or copyright information, you only need to operate once in the "Global Function Settings" of AnQiCMS backend, and the template will automatically synchronize the update, greatly improving the website maintenance efficiency.

Tips and **Practice

  • Multi-site environment:siteIdParameterIf you have created multiple sites through the multi-site management feature of AnQiCMS and need to obtain the global configuration of other sites in the template of a certain site,systemTags also supportsiteIdParameters. For example{% system with name="SiteName" siteId="2" %}It will retrieve the website name of the site with ID 2. However, for the global configuration of the current site, it is usually not necessary to specifysiteId.
  • Variable naming and case: Please notenameThe field name (such asSiteName/SiteLogo) is case-sensitive and must match the definitions in the AnQiCMS backend and documentation.
  • Backend Management: Global SettingsAll these callable global configurations can be managed and updated in "Background Settings" -> "Global Feature Settings". Familiarizing yourself with this area will help you make better use ofsystem.

By flexible applicationsystemLabel, you can easily manage and display the global configuration information of the AnQiCMS website, making your template development and website operation work more efficient and convenient.


Frequently Asked Questions (FAQ)

1. Why is my website name or logo not displayed in the template, or displayed incorrectly?

First, please check whether the "Background Settings" -> "Global Function Settings" of AnQiCMS backend has correctly filled in the "Website Name" or uploaded the "Website Logo".If the background information is blank, the template naturally cannot retrieve the content.nameAre the parameter values correct, for example?SiteNameorSiteLogoAnd the case should be matched exactly. Finally, clear the browser cache and AnQiCMS system cache (through the "Update Cache" function in the background).

Related articles

How does AnQiCMS increase the level of content operation automation through the timed publishing function?

Today, with the increasing emphasis on efficiency and user experience, the degree of automation in content operation is directly related to the competitiveness of the website.For many small and medium-sized enterprises and self-media operators, how to ensure high-quality, frequent, and precise targeting of content under limited human resources is a continuous challenge.AnQiCMS is an efficient and flexible content management system, and its built-in timed publishing function exactly provides strong support for solving this problem.Imagine such a scenario: You have meticulously planned marketing content for a week or even a month, including articles, product updates, and event previews.

2025-11-08

How to implement multi-language content switching and display in AnQiCMS template?

In today's digital world, your website may need to be global for users.AnQiCMS fully understands this requirement and provides powerful multilingual support functions, allowing you to easily build and manage multilingual websites and better serve users from different countries and regions.How to implement multi-language content switching and display in AnQiCMS templates?Let's explore step by step. ### Understanding the multi-language mechanism of AnQiCMS: Handling two types of 'languages' In AnQiCMS, we need to distinguish between two types of 'language' content

2025-11-08

How to configure a separate domain and database information for a new site in AnQiCMS multi-site management?

AnQiCMS with its efficient and flexible multi-site management function provides great convenience to users, especially in scenarios where independent sites need to be built for different brands, products, or services.When you want to configure a separate domain and database information for a new site, AnQiCMS provides a clear and practical management process.This not only helps to isolate and secure the data, but also allows each site to have more independent operation and optimization space.### Understand the value of independent configuration for multiple sites Before discussing the specific operations

2025-11-08

How to configure the pseudo-static rules in AnQiCMS to optimize URL structure and include categories, model aliases?

Building a clear, search engine-friendly URL structure in AnQiCMS is a very important aspect of website operation.By reasonably configuring the pseudo-static rules and cleverly integrating categories and model aliases, not only can it enhance the user experience, but it can also significantly optimize the website's SEO performance.AnQiCMS as a high-performance content management system provides flexible pseudo-static features, allowing us to easily achieve these goals.The importance of optimizing URL structure Imagine you visit a website and see this kind of link: `example

2025-11-08

How to filter the document list based on category ID, model ID, or recommendation attributes for the `archiveList` tag?

In AnQiCMS, flexibly displaying content is one of the keys to building an efficient website.The `archiveList` tag is such a powerful tool that allows us to filter and display the document list of the website based on various conditions.Whether you want to display a certain type of article on a specific page, or organize information based on content type or editor's recommendations, `archiveList` can provide precise control.### Accurate positioning: Filter document list by category ID When we want to display in a certain area of the website, such as the sidebar or a special topic page

2025-11-08

How to create a multi-level category navigation and display its subcategories or related documents in AnQiCMS template?

Build flexible multi-level category navigation and content display in AnQiCMS template Effective organization of website content is crucial for providing a good user experience and improving search engine visibility.Whether it is a corporate website, product display, or self-media blog, a clear multi-level classification navigation can help users quickly find the information they need and is also conducive to search engines understanding the structure of the website.AnQiCMS as an efficient and customizable content management system provides flexible template tags, allowing us to easily implement complex multi-level classification navigation and content display. Next

2025-11-08

How to display comment content and user status for the `commentList` label in AnQiCMS?

Build a highly interactive website in AnQiCMS, the comment function is undoubtedly the key to increasing user engagement.The `commentList` tag is a great tool provided by AnQiCMS for this purpose, it can help website developers and operators flexibly display comment content, and clearly present the status of commenters, allowing visitors to grasp the dynamics of the comment area at a glance.### Core Feature Overview: Basic Usage of `commentList` Tag The `commentList` tag is mainly used to retrieve the comment list of a specified document

2025-11-08

How to enable and use the captcha feature of the留言表单in AnQiCMS?

The website guestbook is a good place to interact with visitors, which brings the website closer to the users.However, without proper protection, the message board will soon be overwhelmed by various spam, malicious submissions, and even automated scripts, which not only affects the cleanliness of the website but may also consume server resources and even damage the reputation of the website.Fortunately, AnQiCMS provides a simple and effective solution: the captcha feature.

2025-11-08