How to use AnQiCMS template tags to retrieve and display the system configuration information of the website?

Calendar 👁️ 65

In AnQi CMS, the system configuration information of the website is the foundation for the operation of the website, including the website name, Logo, filing number, address, and other core data.This information is usually displayed dynamically on various pages of the website (such as the header, footer, contact us page, etc.) to maintain consistency.To facilitate template developers and content operators to efficiently manage and display this information, AnQiCMS provides a simple and powerful template tag that allows you to flexibly obtain and display the system configuration of the website.

Where is the system settings of AnQiCMS?

First, let's understand how these system configuration information is managed in the background.In the Anqi CMS backend management interface, you can enter the 'Global Function Settings' page under 'Backend Settings' via the navigation menu.Here are gathered the core configuration items of the website, such as:

  • Website Name: Usually displayed in the browser title, header, and other locations.
  • Website Logo: The brand logo of the website.
  • Home Page Address: The root URL for accessing the website.
  • Mobile end addressIf a separate mobile site is enabled, this configuration will be available.
  • Template static file addressUsed to load CSS, JavaScript, images, and other static resources.
  • Website registration number: Information in accordance with legal requirements for filing.
  • Copyright content: Display the copyright statement at the footer.
  • Site Language: The default language setting of the website.
  • Custom parameter: Additional configuration items can be flexibly added according to your business needs.

Central management of these settings ensures consistency of website information and greatly reduces the workload of manually modifying template files.When you update this information in the background, the front-end page will immediately synchronize and display the latest content.

Core:systemUsage of template tags.

The key to obtaining and displaying these system configuration information in AnQiCMS templates issystemTemplate tags. The design of this tag is very intuitive, and its basic syntax is as follows:

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

or, if you just want to output the value of a field directly, you can omit it变量名称:

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

Here:

  • 变量名称Is an optional parameter that allows you to assign the obtained configuration value to a custom variable, convenient for multiple references or complex processing in subsequent template logic.
  • name="字段名称"Is a required parameter, used to specify the specific system configuration item you want to retrieve. Here, the 'field name' is the English identifier for each configuration item in the background 'Global Function Settings', for exampleSiteName/SiteLogoetc.
  • If you have deployed multiple sites and need to retrieve the system configuration for a specific site, you can addsiteIda parameter to specify the site ID, for example{% system with name="SiteName" siteId="2" %}This parameter is usually not required in most single-site scenarios.

Obtaining and displaying common system configuration information.

Next, let's look at some common examples to see how you can flexibly use your AnQiCMS templatesystemtags to retrieve and display these system configuration information.

1. Display the website name (SiteName)

The website name is an important identifier for the website identity, usually displayed in the<title>tag or the prominent position in the header of the web page.

<title>{% tdk with name="Title" siteName=true %}</title> {# 结合 TDK 标签获取标题并带上网站名称 #}
{# 或者直接获取网站名称 #}
<h1>欢迎访问:{% system with name="SiteName" %}</h1>
{# 赋值给变量再使用 #}
{% system websiteName with name="SiteName" %}
<p>我们的网站是:{{ websiteName }}</p>

In the above example, we demonstrated two ways to obtain the website name: one is to access it directly throughsystemtag output, and the other is to assign it first towebsiteNameUse the variable again. At the same time, we also saw how to combinetdkThe tag automatically generates a page title containing the website name.

2. Display the website Logo (SiteLogo)

The website logo is a symbol of the brand image. You can place the logo at the header and combine it with the website name asaltattributes to enhance SEO and accessibility.

<a href="{% system with name="BaseUrl" %}">
    <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
</a>
{# 赋值给变量再使用,并确保 Logo 存在才显示 #}
{% system siteLogoPath with name="SiteLogo" %}
{% system siteDisplayName with name="SiteName" %}
{% if siteLogoPath %}
    <img src="{{ siteLogoPath }}" alt="{{ siteDisplayName }}" class="header-logo" />
{% endif %}

Here we also addedifDetermine to ensure that the Logo image path exists before rendering<img>Tags to avoid displaying broken images.

3. Get the home page address of the website (BaseUrl)

When building internal links in a template, the home page address of the website is the foundation. UseBaseUrltags to ensure the correctness of the link, even if the domain name of the website changes, it only needs to modify the background configuration.

<nav>
    <a href="{% system with name="BaseUrl" %}">首页</a>
    {# ...其他导航链接... #}
</nav>

4. Reference static file address (TemplateUrl)

Your template may depend on specific CSS stylesheets, JavaScript scripts, or image resources.TemplateUrlLabels can help you build the correct static file path and adapt to different deployment environments.

<link rel="stylesheet" href="{% system with name="TemplateUrl" %}/css/style.css">
<script src="{% system with name="TemplateUrl" %}/js/main.js"></script>

5. Display the website filing number (SiteIcp)

For websites that need to display filing information,SiteIcpThe label can be conveniently output in the footer and other locations, and it usually links to the Ministry of Industry and Information Technology website.

<p>
    <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a>
</p>

6. Display copyright content (SiteCopyright)

The copyright statement at the bottom of the website page is a common content. If the copyright information configured on the back end may contain HTML tags (such as bold, links), don't forget to usesafeA filter to ensure that content is parsed correctly rather than escaped.

<footer>
    <p>{% system copyrightInfo with name="SiteCopyright" %}{{ copyrightInfo|safe }}</p>
</footer>

7. Set the site language (Language)

in the HTML document's<html>Set in the labellangattribute is important for multilingual support and SEO.

<html lang="{% system with name='Language' %}">
{# ... #}
</html>

8. Call custom parameters

AnQiCMS's 'Global Function Settings' allows you to add custom parameters. If you create a named parameter calledHelpUrlThe custom parameter is used to store the link to the help page, which can be called in the following way:

<a href="{% system with name="HelpUrl" %}">帮助中心</a>

Through these examples, you can seesystemHow template tags can help you easily retrieve and display various system configuration information in AnQiCMS templates.This not only improves the flexibility and maintainability of the template, but also makes website operation more efficient.

Frequently Asked Questions (FAQ)

Q1: Why do I call{% system with name="SiteLogo" %}After, the front-end image did not display?

A1: This usually has several reasons. First, please check if you have correctly uploaded and configured the 'website logo' image in the background 'global feature settings'.If the backend is not set, the tag naturally cannot obtain the value.Next, check if the image path is correct, and whether the image file on the server exists and is accessible.If the image is a remote link, you also need to ensure that the link is valid.In some cases, you may need to manually clear the browser cache to ensure the latest resources are loaded.

Q2: Can I get the information from the "Contact Information Settings" or "Homepage TDK Settings" in the background? They are also part of the system configuration.

A2: Of course you can. Although this information also belongs to the system-level configuration of the website, AnQiCMS provides special template tags for better organization and management.For example, you can use{% contact with name="Cellphone" %}To get the contact phone number, use{% tdk with name="Keywords" %}To get the home page keywords. The article introducessystemTags are mainly used for general system parameters in the "Global Function Settings", and more specific information is provided by the corresponding

Related articles

How does AnQiCMS's scheduled publishing function ensure that content is displayed accurately on the website as planned?

In today's fast-paced digital world, the timing of publishing website content is often as important as the content itself.In order to coordinate with market activities, seize hot news, or simply to maintain the regularity of content publication, the ability to accurately control the timing of content going live is crucial.AnQiCMS (AnQiCMS) deeply understands this, and its built-in scheduled publishing function is designed to meet this core requirement, ensuring that your website content is displayed accurately and as planned to visitors.### Say goodbye to manual operation

2025-11-07

How to use AnQiCMS pseudo static and 301 redirect function to optimize URL structure to improve SEO display effect?

In website operation, the structure of URL has a significant impact on search engine optimization (SEO) effectiveness.A clear, concise, and descriptive URL that can improve user experience and help search engines better understand page content, thereby improving crawling efficiency and ranking.AnQiCMS is a powerful content management system that provides comprehensive pseudo-static and 301 redirect functions, helping us create an ideal URL structure.### Understanding SEO-friendly URLs and their importance Imagine that

2025-11-07

How to configure AnQiCMS multilingual support to switch and display content correctly?

AnQiCMS provides powerful multilingual support features, helping us easily promote website content to global users.However, in order to correctly switch and display multilingual content, we need to understand the design approach of AnQiCMS in this regard and configure and manage it through several key steps.It mainly achieves independent content for different language versions by combining "multi-site management", and at the same time provides "default language packages" and "translation tags" to handle the static text in the system built-in text and templates.## Understanding AnQiCMS's multilingual mechanism First

2025-11-07

How to implement unified management and display of multi-site content on the front end in AnQiCMS?

Manage and display the content of multiple websites in AnQiCMS, which is a common need for many operators, especially when you need to manage multiple brand sites, product sub-sites, or provide customized content for users in different regions or languages.AnQiCMS was designed with this in mind from the outset, providing a flexible and efficient solution that allows you to easily manage the content of multiple front-end sites from a single backend.### Backend unified management: One system, multiple sites One of the core strengths of AnQiCMS is that it supports multi-site management

2025-11-07

How to call and display the title, content, and related fields of a document on the AnQiCMS article detail page?

In AnQiCMS, the content detail page is the key area where you display core information and attract readers.Effectively call and display the title, content, and various related fields of the document, which can greatly enhance user experience and the richness of page information.The powerful template engine of AnQiCMS provides an intuitive and flexible way to achieve these goals.## Understanding AnQiCMS Template Syntax AnQiCMS's template system uses syntax similar to Django template engine, it mainly operates data and logic through two forms: * **Double Curly Braces

2025-11-07

How to implement custom display templates for category pages in AnQiCMS?

AnQiCMS provides excellent flexibility in website content management, especially when dealing with category page displays. It is not limited to a single fixed layout but allows users to set personalized display templates for category pages based on different business needs and design concepts.This is undoubtedly a very practical feature for operators who hope to improve user experience, strengthen brand image, or optimize specific SEO strategies through differentiated content display.How is it specifically implemented to customize the display template of the category page in AnQiCMS?

2025-11-07

How to correctly display Markdown formatted mathematical formulas and flowcharts in AnQiCMS?

For users who often need to publish technical articles, tutorials, or academic content, the Markdown editor is undoubtedly a tool that improves efficiency.Its concise syntax makes content creation intuitive and quick. AnQiCMS, as a modern content management system, naturally takes full consideration of the use scenarios of Markdown and provides strong support.However, when we need to insert complex mathematical formulas or draw intuitive flowcharts in Markdown-formatted articles, relying solely on the features of Markdown itself is not enough. At this point

2025-11-07

How does AnQiCMS manage and display single-page content, such as 'About Us' or 'Contact Us'?

In website operation, we often need to create some fixed content, large information independent pages, such as "About Us", "Contact Us", "Terms of Service" or "Privacy Policy" and so on.These pages are usually called single-page content, they are an indispensable part of the website, used to provide visitors with core information, build trust, or guide operations.AnQiCMS provides an intuitive and flexible solution for managing and displaying this type of single-page content.

2025-11-07