How to get and display the website global information using the AnQiCMS system settings label `system`?

Calendar 👁️ 62

In website construction and daily operation, we often encounter situations where we need to display some global information, such as the name of the website, Logo, filing number, contact information, etc.This information runs through the entire website and needs to be consistent across multiple pages.AnQiCMS provides an extremely convenient way to handle such global information, that is, through its built-insystemTemplate label.

Get to knowsystemLabel: Key to get global information of the website

systemTags are like keys that can help you easily retrieve and display various global website information configured in the background "Global Feature Settings" template.You do not need to manually copy the code or worry about inconsistent information, just call it, AnQiCMS will automatically render the latest global settings for you.

Its basic usage method is very intuitive:

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

There are two core parts that need to be understood here:

  • name="字段名称"This is the most important part, it specifies the specific global information you want to obtain. For example, if you want to get the website name, then字段名称that isSiteName; if you want to get the website logo, that isSiteLogoThese field names are usually corresponding to the items in the background setting page.
  • 变量名称This is an optional parameter. If you want to store the global information obtained into a variable for reuse in other parts of the template or for some complex logic processing, you can give it a variable name, for examplesiteName)。If you do not need to store it, you can omit the variable name, AnQiCMS will directly output the corresponding value at the current position.

In addition, for users managing multiple sites,systemLabels also support asiteIdParameters allow you to specify the information to be retrieved from a specific site. However, in most single-site cases, we usually do not need to set this parameter, as the tag automatically retrieves information about the current site.

Common global information and its retrieval method

Now, let's look at how to use it through some specific examplessystemTags to retrieve and display common website global information:

  1. Website name (SiteName)This is the brand name of the website, usually displayed in the browser title bar, web page header, and other locations.

    <title>{% system with name="SiteName" %}</title>
    <h1>欢迎来到 {% system with name="SiteName" %}</h1>
    
  2. Website Logo (SiteLogo)The visual identity of the website, generally appearing in the header.

    <a href="/">
        <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
    </a>
    
  3. Website filing number (SiteIcp)If your website is registered, this information is usually required to be displayed at the bottom of the website.

    <p><a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a></p>
    
  4. Copyright content (SiteCopyright) with the current yearCommon footer copyright statements usually include the current year. AnQiCMS provides a{% now "2006" %}tag to conveniently get the current year.

    <div>
        {% system siteCopyright with name="SiteCopyright" %}{{siteCopyright|safe}}
        &copy; {% now "2006" %}. All Rights Reserved.
    </div>
    

    Here, we first declareSiteCopyrightthe content to assign tositeCopyrightthe variable, and then use|safeThe filter ensures that content with HTML code can also be parsed and displayed correctly.

  5. The home page address (BaseUrl)This tag comes in handy when you need to retrieve the root directory URL of a website.

    <link rel="home" href="{% system with name="BaseUrl" %}" />
    
  6. Static file address of the template (TemplateUrl)The CSS, JS, and images of the template are usually stored in a specific directory. UseTemplateUrlIt can help you build the correct path for static files.

    <link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">
    <script src="{% system with name="TemplateUrl" %}/js/main.js"></script>
    
  7. Site language (Language)If you have set the default language of the website in the background, you can get the language code through this tag, usually used in HTML tags.langProperty.

    <html lang="{% system with name='Language' %}">
    
  8. Custom parameters (后台自定义设置的参数名)AnQiCMS allows you to add custom parameters in the background "Global Function Settings".These parameters can be your website's unique contact information, social media links, or any information you need to globally call.For example, if you add a namedHelpUrlYou can call it like this:

    <div>我们的帮助页面:<a href="{% system with name="HelpUrl" %}" target="_blank">点击这里</a></div>
    

Integrate global information into the website

BysystemTags, we can easily call these global information in various parts of the website (such as headers, footers, sidebars, etc.), thereby ensuring the consistency and maintainability of the entire website. For example, a typical website footer may contain copyright information, filing number, and contact information, which can be accessed throughsystemTags andcontactLabel (for contact information) combination implementation:

<footer>
    <div class="container">
        <p>
            {% system siteCopyright with name="SiteCopyright" %}{{siteCopyright|safe}}
            &copy; {% now "2006" %}. All Rights Reserved.
        </p>
        <p>
            备案号:<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a>
        </p>
        <address>
            联系我们:{% contact with name="Cellphone" %} | 邮箱:{% contact with name="Email" %}
        </address>
    </div>
</footer>

Summary

systemThe template tag is a very practical feature in AnQiCMS, which greatly simplifies the management and display of global information on the website.By flexibly using this tag, you can easily build a website with clear structure, consistent information, and easy maintenance, making your content operations more efficient.


Frequently Asked Questions (FAQ)

Q1: I added a custom parameter in the "Global Function Settings" backend, how can I call it in the frontend template?A1: Very simple. Suppose you add a custom parameter named "Social Media Link" in the background, and fill in the "Parameter Name" asSocialMediaLinkand set the value. In the front-end template, you can access{% system with name="SocialMediaLink" %}to retrieve and display this value.

Q2: Has my website enabled the multi-site management feature? Do I want to display the global information of another site in the template of one of the sites, can it be achieved?A2: OK.systemTag supportsiteIdParameter. You need to know the target site'ssiteId(It is usually visible on the multi-site management page in the backend), and then call it like this:{% system with name="SiteName" siteId="2" %}This will display the website name of the site with ID 2.

Q3: Why did the front page not update immediately after I modified the global settings in the background?A3: This could be due to the system cache of AnQiCMS.You can try to clear the system cache. In the AnQiCMS backend, there is usually an option like "Update Cache" or similar, click it to refresh the cache and make the global settings take effect immediately.If the problem still exists, please check if the field names in the template are spelled correctly and if any are missing{% system ... %}.

Related articles

What is the impact of folder organization mode and flat file organization mode on template production and content display?

When building website templates in AnQi CMS, the organization of template files is one of the core issues you need to pay attention to.AnQi CMS provides two main template organization modes: **Folder Organization Mode** and **Flattened File Organization Mode**.These two modes have their own characteristics, and their choice will directly affect the efficiency of your template creation and the final presentation of the content.Understand their differences and impacts, which can help you make more informed decisions based on project needs.### Folder Organization Mode

2025-11-07

How to configure specific template files for the homepage, detail page, list page, etc. of AnQiCMS to control the display?

AnQiCMS, with its high efficiency and flexible customization features developed in the Go language, provides strong control over the display of website content.Whether you are operating a small and medium-sized enterprise website, a personal blog, or need to manage multiple sites, understanding how to configure exclusive templates for different pages is the key to improving website personalization and user experience.In AnQiCMS, the core of content display lies in the template files.These files determine the visual layout, content formatting, and interactive elements of the website.AnQiCMS uses a syntax similar to Django template engine

2025-11-07

Template creation in progress, how do the public code (bash.html) and snippet directory (partial/) affect the page display?

In Anqi CMS, when we start building or modifying website templates, we come across some core files and directory structures, among which the public code file `bash.html` and the code snippet directory `partial/` play a crucial role in the final page display.They are not just a simple pile of template files, but also the 'skeleton' and 'building blocks' that make up the structure and display logic of the website, allowing our website to maintain consistency while having high flexibility and maintainability.

2025-11-07

How does the AnQiCMS v2.0.1 version's new article content batch replacement and paraphrasing feature change the display of content?

## AnQiCMS v2.0.1: How do the content renewal, batch replacement and pseudo-original function change the website display?Today, in the increasingly fierce digital marketing, website content must not only be of high quality but also maintain freshness and flexibility.For content operators, how to efficiently manage and optimize a large amount of content while ensuring its good performance in search engines and in front of users is always a challenge.AnQiCMS v2.0.1 version brings the batch replacement and paraphrasing function of article content, which is designed to solve these pain points, and they are implemented in an intelligent way

2025-11-07

How to dynamically display the `contact` label of the company contact information?

In website operation, clear, accurate and easy-to-update business contact information is a crucial link.Imagine if you need to update your contact phone number or email, do you need to manually modify every web page that contains this information?This is not only time-consuming and labor-intensive, but may also lead to inconsistent information due to omissions, affecting user experience and brand image. AnQiCMS (AnQiCMS) is well-versed in this, and to address this pain point, it has specially provided the **contact label `contact`**.

2025-11-07

How to generate and display personalized SEO titles, keywords, and descriptions for different pages using the universal TDK tag `tdk`?

In website operation, optimizing search engines (SEO) is a key link to obtaining natural traffic.And TDK (Title, Description, Keywords) as the first impression of the page presented in search engine results, its importance is self-evident.It not only affects the ranking of the website on the search results page, but also directly determines whether the user will click to enter your website.AnQiCMS knows the value of TDK for SEO and therefore provides a highly flexible and powerful universal TDK tag——`tdk`.

2025-11-07

How to build and display the hierarchical navigation menu of the website's navigation list label `navList`?

In website operation, a clear and convenient navigation menu is the key to user experience, as well as an important basis for search engines to understand the website structure.AnQiCMS provides powerful navigation management features, and its template tag `navList` is the core tool for building these hierarchical navigation menus on the front end.

2025-11-07

How to dynamically generate and display the current page's breadcrumb navigation path? breadcrumb

In website operation, a clear navigation path is crucial for user experience and search engine optimization.Imagine, when users browse your website, it's like exploring a strange city. If they can always see where they are and how they got there, it will greatly enhance their confidence and browsing efficiency.This is the value of breadcrumb navigation (Breadcrumb Navigation).It is like a trail of breadcrumbs in your hand, providing a clear path for users from the homepage to the current page.

2025-11-07