How to retrieve and display the system configuration information of the website in the template?

Calendar 👁️ 60

In website operation, we often need to display some global website information, such as website name, Logo, filing number, copyright statement, and even customized contact information or social media links.This information, if directly hardcoded in the template, would require searching and updating each page whenever a modification is needed, which is time-consuming and prone to errors.AnQi CMS provides a very powerful and convenient template tagsystemLabel, allowing these system configuration information to be dynamically retrieved and displayed in the template, greatly enhancing the maintainability and operational efficiency of the website.

systemLabel: Convenient entry point for website information

systemThe tag is a core tool used by Anqi CMS to obtain various configurations from the "Global Function Settings" in the background.By it, you can flexibly call website name, Logo, basic link and a series of important system-level data at any location in the website template.

Its basic usage is very intuitive:{% system 变量名称 with name="字段名称" %}.

here,name="字段名称"Specify the specific system configuration item you want to retrieve, and变量名称It is optional. If you provide a variable name, the value of this configuration item will be stored in this variable, and you can use it in the subsequent code.{{变量名称}}Output; if you do not provide a variable name,systemthe tag will output the configuration value directly to the current position.

in addition to getting the information of the current site,systemLabels also support asiteIdParameters. If you are managing multiple sites and need to call system configurations of other sites, you cansiteIdSpecify the target site. But in most cases, we usually only need to get the information of the current site, so this parameter can be ignored.

Get the commonly used system configuration information

Let's take a look atsystemTags can retrieve specific configurations and how to call them in the template.

Website name (SiteName)

This is the most basic identifier of the website, usually displayed in the browser title bar, next to the Logo, or in the footer.

{# 直接输出网站名称 #}
<div>网站名称:{% system with name="SiteName" %}</div>
{# 将网站名称赋值给变量并输出 #}
<div>网站名称:{% system currentSiteName with name="SiteName" %}{{currentSiteName}}</div>

Website Logo (SiteLogo)

The brand logo of a website, usually a link to an image.

{# 直接输出Logo图片,并使用网站名称作为alt属性,提升SEO #}
<img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
{# 将Logo链接赋值给变量,再构建图片标签 #}
{% system siteLogoPath with name="SiteLogo" %}
<img src="{{siteLogoPath}}" alt="{% system with name="SiteName" %}" />

Website filing number (SiteIcp)

According to national regulations, the record information is usually displayed in the footer of the website.

{# 显示备案号,并链接到工信部备案查询平台 #}
<p><a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a></p>

Copyright content (SiteCopyright)

Footer copyright statement, which can include the year and company name, etc.

{# 直接输出版权信息,注意使用safe过滤器以防HTML内容被转义 #}
<div>{% system with name="SiteCopyright"|safe %}</div>
{# 赋值给变量并输出 #}
{% system copyrightInfo with name="SiteCopyright" %}
<div>{{copyrightInfo|safe}}</div>

The home page address (BaseUrl)

This is the root URL of the website, which is very useful when building absolute links.

{# 获取网站首页地址,用于构建返回首页的链接 #}
<a href="{% system with name="BaseUrl" %}" class="home-link">返回首页</a>

Mobile address of the website (MobileUrl)

If your website has enabled a separate mobile domain (configured in the background "Global Feature Settings"), you can obtain it here.

{# 在PC端判断并提供手机端链接,引导用户切换 #}
{% system mobileSiteUrl with name="MobileUrl" %}
{% if mobileSiteUrl %}
    <a href="{{mobileSiteUrl}}" class="mobile-version-link">访问手机版</a>
{% endif %}

Static file address of the template (TemplateUrl)

Used to link the template directory below, such as CSS, JS, images, and other static resources, ensure the path is correct.

{# 链接模板目录下的样式表 #}
<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">
{# 链接模板目录下的JavaScript文件 #}
<script src="{% system with name="TemplateUrl" %}/js/main.js"></script>

Closed site prompt content (SiteCloseTips)

When the website is in maintenance or closed, the system will display the prompt information configured here.

{# 在网站维护页面显示闭站提示 #}
<div class="maintenance-message">
    <p>{% system with name="SiteCloseTips" %}</p>
</div>

Site language (Language)

Indicates the language used by the current website, often used for<html>label'slangProperty.

{# 在HTML根标签中设置语言属性 #}
<html lang="{% system with name='Language' %}">

Custom parameter

The strength of AnQi CMS lies in its high customizability.In the background "Global Feature Settings", you can add any number of custom parameters to meet the personalized calling needs in the template.For example, you may want to add configuration items such as a 'WeChat official account QR code' or 'help page link'.

Assuming you have created a namedHelpPageUrlThe custom parameter, with a value ofhttps://www.yourdomain.com/help. You can call it like this in the template:

{# 调用自定义的帮助页面链接 #}
<a href="{% system with name="HelpPageUrl" %}">访问帮助中心</a>
{# 将自定义参数赋值给变量 #}
{% system helpLink with name="HelpPageUrl" %}
<p>更多信息请点击:<a href="{{helpLink}}">{{helpLink}}</a></p>

Practical suggestions and flexible application

Rational utilizationsystemTags, which can make your website template more flexible. You can place them in the public header file (such aspartial/header.htmlCalling inSiteName/SiteLogoandTemplateUrlIn the footer file (such aspartial/footer.htmlCalling inSiteIcpandSiteCopyrightManage custom contact information or social media links through custom parameters.This way, once some information needs to be updated, it only needs to be modified once in the background, and all pages that call this information will be automatically synchronized for updates, greatly reducing the cost and risk of manual intervention and errors.

Furthermore,systemThe information retrieved by the label is dynamic, which means that when you change the configuration in the background, the front-end page will immediately reflect these changes (unless there is a caching mechanism involved, but usually just refreshing the page is enough to see them).This is crucial for the daily maintenance of the website and quick response to market changes.

In this way, Anqi CMS not only provides powerful content management capabilities, but also throughsystemA series of flexible template tools, giving website operators full control, making website management unprecedentedly easy and efficient.


Frequently Asked Questions (FAQ)

1. Why didn't the front-end page update immediately after I modified the system settings in the background?The Anqi CMS usually improves website access speed through caching mechanisms.If you have modified the system configuration in the background but the front-end page does not display the new content immediately, it may be because the cache has not been refreshed.Try clearing the browser cache, or find the "Update Cache" feature in the Anqi CMS backend and execute it, you should usually see the latest configuration.

2. In the template usagesystemwhen calling custom parameters with tags,nameHow should the attribute be filled in? nameThe value should be exactly the same as the 'parameter name' you entered when adding custom parameters in the background 'Global Function Settings'. Please note that Anqi CMS is case-sensitive for parameter names and it will automatically convert the input letters to camel case (for example, you inputhelp page urlMay be processed by the system asHelpPageUrl), so make sure the template innamematches the actual parameter name stored on the back end.

3.BaseUrlandTemplateUrlWhat is the difference? When should I use them? BaseUrlis the root address of the website, for examplehttps://www.yourdomain.com/It is mainly used to build absolute links for in-site pages, ensuring that users can be correctly directed to the target page regardless of where they navigate from.TemplateUrlIt is the URL of the current active template directory, for example.https://www.yourdomain.com/template/default/It is mainly used to refer to static resources within the template, such as CSS, JavaScript files, or images, to ensure that these resources can be loaded correctly by the browser. Simply put,BaseUrlIs the basis of website content navigation,TemplateUrlIs the basis of template resource loading.

Related articles

How to customize a dedicated content display template for a specific document ID or category ID?

In website operations, we often encounter such needs: a particular product display page needs a unique layout to emphasize its features, or an important event special page needs special design to attract users, or a "About Us" single-page site wants to show a different brand character.Anqi CMS provides us with a flexible way, allowing us to customize exclusive display templates for these unique content needs, thus greatly enhancing the visual appeal and user experience of the website.The Anqi CMS template system has adopted the Django template engine syntax

2025-11-08

What is the default template file name for the document detail page and list page?

When using AnQiCMS for website building and content management, understanding the naming conventions of its template files is crucial for customizing and optimizing the website appearance.AnQi CMS to simplify template management, provides a flexible and default recognition naming convention, allowing website developers and operators to work more efficiently.First, all template files should be unified to use the `.html` suffix and placed in the `/template` folder under the website root directory.the styles and JavaScript scripts used in the template

2025-11-08

How can we design and display a separate content template for mobile devices to optimize the mobile user experience?

It is crucial to optimize the mobile user experience for modern website operations, and designing content templates specifically for mobile devices is an efficient way to achieve this goal.AnQi CMS provides a flexible mechanism, allowing users to provide the most suitable browsing experience for different terminals according to their needs.### Understanding AnQi CMS Mobile Template Mode AnQi CMS is designed to meet the diverse mobile adaptation needs and includes three main website modes that determine how content is displayed to mobile users: * **Responsive Template Type**

2025-11-08

What template types does AnQiCMS support to adapt to the display of content on different devices?

In today's digital world, users access websites through various devices, which has become the norm.From wide PC monitors to palm-sized smartphones, how to present website content seamlessly and efficiently is a challenge that every operator must face.AnQiCMS deeply understands this, providing users with a variety of flexible template adaptation strategies to ensure that your website can display the effect on different devices.AnQiCMS mainly supports three template types to adapt to the content display of different devices, each type has its unique application scenarios and advantages, and you can choose according to your own business needs and operational strategy

2025-11-08

How to display contact information on the page, such as phone number, address, etc.

The contact information of the website is an important part of establishing user trust and providing convenient services.Whether it is displaying a simple phone number at the bottom of the website or providing detailed addresses and social media links on the "Contact Us" page, Anqi CMS offers a flexible and efficient way to manage and present these key information.This article will delve into how to set up and display all the contact information on your website using Anqi CMS, ensuring that your customers can easily find you.### Backend Management:Unified setting your contact information In AnQi CMS

2025-11-08

How to dynamically display SEO titles, keywords, and descriptions (TDK) on different pages?

In website operation, Search Engine Optimization (SEO) is a key element in enhancing website visibility.Among them, the page title (Title), keywords (Keywords), and description (Description), abbreviated as TDK, play a crucial role.They are not only the primary information that search engines understand the content of the page, but also an important factor in attracting users to click.In AnQiCMS (AnQiCMS), we can easily implement the dynamic display of TDK, allowing each page of the website to have appropriate and attractive TDK information

2025-11-08

How to build and display a multi-level navigation menu for a website?

Website navigation, like the skeleton and compass of a website, it guides visitors to explore the website content, and is the core of user experience and information architecture.A clear and accessible navigation menu that not only helps users find the information they need quickly, but is also crucial for search engine optimization (SEO).AnQiCMS (AnQiCMS) is well-versed in this, providing powerful and flexible navigation management features that allow you to easily build and display multi-level navigation menus.Next, we will delve deeper into how to build and display your website navigation step by step in Anqi CMS.--- ### One

2025-11-08

How to display breadcrumb navigation on the page to enhance users' understanding of the content structure?

When we browse websites, we often see a line of text at the top or above the content area, clearly indicating the position of the current page within the overall website structure, like "Home > Product Center > Some Product Category > Some Product Detail" and so on.This is what we commonly refer to as 'Breadcrumb Navigation'.It can not only help users quickly understand the content hierarchy of the website, avoid getting lost, but also play an important role in user experience and search engine optimization (SEO).Aq CMS fully understands the importance of breadcrumb navigation

2025-11-08