How to retrieve and display the system global settings of AnQiCMS template, such as website name, Logo, filing number, and copyright information?

Calendar 👁️ 72

When building a website, some core information such as the website name, website logo, filing number, and copyright information are indispensable elements.These global settings not only help visitors quickly identify your brand, but also reflect the professionalism and compliance of the website.AnQiCMS provides a直观而灵活的方式来管理和在模板中呈现这些系统级的信息方式。

Where can I set these global information?

First, all this important website information needs to be unifiedly configured in the AnQiCMS backend.usually, you can find the 'background settings' under the background navigation menu, which includes 'global feature settings'.

In this interface, you can easily enter and adjust the following information:

  • Website NameYour website or brand name, which is usually displayed in the browser tab or at the top of the website page.
  • Website LogoUpload your brand logo image, which will be the core of the website's visual recognition.
  • Record numberIf your website operates in mainland China and has been registered, you can fill in the registration number here.
  • Copyright informationIt is usually displayed in the footer of the website, used to declare the copyright of the website content.
  • In addition, there are other important global settings such as website address, mobile end address, default language package, and the ability to add custom parameters to meet more personalized needs.

After completing these settings, this information will be stored in the system, waiting for your template to call it.

How can you retrieve and display this information in the template?

AnQiCMS provides a template tag specifically used to obtain the global system configuration—system. This tag is very flexible and can help us retrieve the required global settings in any template file of the website.

UsesystemThe basic syntax of the tag is like this:{% system 变量名称 with name="字段名称" %}

here,字段名称Corresponding to the internal identifiers of each configuration item in the background "Global Function Settings". You can choose to output the value of this field directly, or assign it to a变量名称Then use this variable in other places of the template.

Next, let's take a look at several commonly used global information examples to see how they are obtained and displayed in the template.

1. Display the website name

The website name usually appears on the<title>tags, headers, or footers and other key positions.

{# 直接输出网站名称 #}
<title>{% tdk with name="Title" siteName=true %}</title> {# 使用tdk标签自动组合标题和网站名 #}
<h1>欢迎访问 {% system with name="SiteName" %}</h1>

{# 也可以将网站名称赋值给一个变量再使用 #}
{% system siteNameVar with name="SiteName" %}
<p>当前网站的名称是:{{ siteNameVar }}</p>

In the above examples, we have shown two ways to obtain the website name. In<title>Labels, we used a more professionaltdkLabels automatically handle the combination of page titles and website names, while obtaining the page title, it can also pass throughsiteName=trueThe parameter automatically appends the website name configured in the background to the page title. And in<h1>and<p>tags, we use them directlysystemtags or through variablessiteNameVarTo display the website name.

2. Display website Logo

The website logo is an important part of brand identification, usually displayed in the header as an image.

{# 直接输出网站Logo图片 #}
<img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %} Logo" />

{# 也可以将Logo地址赋值给一个变量再使用 #}
{% system siteLogoUrl with name="SiteLogo" %}
{% system siteNameForLogo with name="SiteName" %}
<a href="/">
    <img src="{{ siteLogoUrl }}" alt="{{ siteNameForLogo }} 的Logo" />
</a>

In displaying the logo, in addition tosrcThe attribute points to the address of the Logo image (provided{% system with name="SiteLogo" %}by us, we strongly recommend that you set<img>tagsaltthis attribute.altThe value is usually the website name, which not only helps search engines understand the content of the image, but also provides meaningful text alternatives when the image cannot be loaded.

3. Display the filing number

If your website has a record number, it will usually be displayed in the footer of the website and linked to the Ministry of Industry and Information Technology record query website.

{# 直接输出备案号并添加链接 #}
<p>
    <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">
        {% system with name="SiteIcp" %}
    </a>
</p>

{# 也可以通过变量来组织显示 #}
{% system icpNumber with name="SiteIcp" %}
{% if icpNumber %} {# 判断备案号是否存在,再进行显示 #}
<p>
    本网站由 <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{{ icpNumber }}</a> 提供备案支持。
</p>
{% endif %}

In the above code, we usedrel="nofollow"andtarget="_blank"Property.nofollowThe attribute tells the search engine not to track this link because it is an external, possibly unrelated government website link;target="_blank"Open the link in a new window or tab to avoid visitors leaving your website.

4. Display copyright information

Copyright information is usually located at the footer of the website, declaring the ownership of the website content. Since copyright information may contain HTML tags such as&copy;Symbols, links, etc., should be paid special attention to when used.

{# 将版权信息赋值给变量并使用 |safe 过滤器输出 #}
{% system copyrightInfo with name="SiteCopyright" %}
<p>
    {{ copyrightInfo|safe }}
</p>

{# 结合当前年份显示 #}
<footer>
    <p>
        &copy; {% now "2006" %} {{ copyrightInfo|safe }}
    </p>
</footer>

It needs to be emphasized here|safeA filter. If the background copyright information contains HTML tags and you want these tags to be parsed correctly by the browser rather than displayed as plain text, you must use|safeFilter. Otherwise, like&copy;The HTML entity will be displayed as is, not a copyright symbol©. You can also combine with{% now "2006" %}Tag dynamically displays the current year, keeping the copyright information up to date.

5. Other common global information

In addition to the above items,systemthe tag can also obtain other useful global information:

  • The home page address (BaseUrl): Very useful when building absolute links in templates.{{ "%s/some-page"|format(system.BaseUrl) }}
  • Static file address of the template (TemplateUrl)Points to the directory of static resources (CSS, JS, images) of the current template.<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">
  • Site language (Language)Can be used for<html>label'slangproperties, which help with internationalization and SEO.<html lang="{% system with name='Language' %}">

6. Retrieving custom parameters

If you add custom parameters (such as, one namedSupportEmailcustomer service email), you can also access them in the template in the same way:

{% system supportEmail with name="SupportEmail" %}
<p>客服邮箱:<a href="mailto:{{ supportEmail }}">{{ supportEmail }}</a></p>

Summary

BysystemLabel, AnQiCMS provides an extremely convenient way to manage and present the global configuration information of the website. Whether you are displaying basic website information, referencing static resource paths, or calling custom configuration items,systemTags can help you complete tasks in a concise and efficient manner, allowing you to focus more on creating and operating website content.Correctly using these tags can greatly enhance the maintenance efficiency of the template and the overall user experience of the website.


Frequently Asked Questions (FAQ)

Q1: Why does the HTML link I set in the background display the HTML code directly instead of a clickable link when displayed on the front end? A1:This is because the AnQiCMS template engine defaults to escaping output content to prevent XSS attacks. If you want HTML code to be parsed normally, you need to use|safeFilter. For example, if your copyright information is&copy; 2023 <a href="/">我的网站</a>, it should be written as in the template{{ copyrightInfo|safe }}.

Q2: How do I retrieve the global settings for a specific site when my website has the multi-site feature enabled, rather than the current site? A2:`

Related articles

How to retrieve and display the list of Tag tags and their corresponding links for an article?

In a website with increasingly rich content, how to effectively organize and present information is crucial.The Tag label (usually referred to as keywords or tags) not only helps users find related content quickly, but is also an indispensable part of Search Engine Optimization (SEO).AnQi CMS understands this point, providing users with a powerful and flexible tagging function, allowing you to easily add tags to articles and display these tags and their corresponding links in multiple forms on the website front end.

2025-11-07

How to dynamically retrieve and display the content of custom model fields for an article in a template?

In AnQi CMS, the flexibility of website content is one of the key advantages for our content operation and website layout.By customizing content model fields, you can add unique properties for different types of content (such as articles, products), which can better reflect your business needs.But how can we dynamically present these carefully defined custom field contents in the front-end template of the website?This article will discuss this topic in detail, helping you fully utilize the powerful functions of AnQiCMS.

2025-11-07

How to retrieve and display a list of articles under a specific category (or multiple categories) in AnQiCMS?

In AnQiCMS, flexibly displaying website content is the key to improving user experience and website functionality.No matter if you are running a corporate website, a personal blog, or a marketing site, you often encounter the need to display a list of the latest articles, popular products, or multiple related category content under a specific category on a particular page.AnQiCMS's powerful template tag system, especially the `archiveList` tag, can help you easily achieve this goal.

2025-11-07

How to configure and display related article lists on the article detail page, and specify relevance rules (such as keywords or manual settings)?

How to make visitors easily find more related content after reading an excellent article on your website, continue to explore your website, which can not only significantly improve user experience, but also is a key strategy to optimize website SEO and reduce bounce rate.AnQiCMS (AnQiCMS) offers powerful and flexible features, allowing you to easily configure and display related article lists on the article detail page and specify relevance rules according to actual needs.Next, we will together learn how to achieve this goal in Anqi CMS.

2025-11-07

How to obtain and display the contact information of the website in AnQiCMS, such as phone, email, address, and social media links?

It is crucial to clearly display contact information when building and operating a website to establish user trust and provide customer support.AnQiCMS as an efficient content management system provides an intuitive way to manage and display this key information, whether it is traditional phone numbers, email addresses, or modern social media links, it can be easily realized. ### One, Back-end Configuration: Centralize Your Contact Information AnQiCMS has designed a centralized area for you to manage all website contact information in one place.

2025-11-07

How does AnQiCMS use the `navList` tag to build and display multi-level website navigation menus?

When building a website with comprehensive functions, a clear and intuitive navigation menu is the core of user experience.AnQiCMS provides a powerful template tag system, where the `navList` tag is specifically used to build and display a multi-level navigation menu for the website.It not only can display the navigation structure you configure in the background, but also help you convert technical details into user-friendly interactive experiences.### The Foundation of Building Navigation: Backend Settings Before using the `navList` tag, you first need to set up in AnQiCMS

2025-11-07

How to display breadcrumb navigation in AnQiCMS template and customize the home page name or whether to include the current page title?

Have you ever felt a bit confused while browsing websites, not knowing where you are?Breadcrumb Navigation is like leaving a series of small markers along the way as you explore a new place, making it clear where you came from and where you are now.It can significantly enhance the user experience of the website, help visitors quickly understand the website structure, and is very beneficial for search engine optimization (SEO), as it provides clear website hierarchy information for search engine spiders.

2025-11-07

How AnQiCMS dynamically generates and displays page Title, Keywords, and Description (TDK) to optimize SEO?

In website operation, to make your content stand out in search engines, attract more target users, and cannot do without the careful setting of these three core elements: Title, Keywords, and Description (TDK).AnQiCMS knows the importance of TDK for SEO, and has integrated a complete dynamic TDK generation and management mechanism from the beginning of the system design, allowing you to flexibly and efficiently optimize every page of your website.

2025-11-07