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

Calendar 👁️ 56

When building website templates in AnQiCMS, we often need to display some general information at the website level, such as the website name, Logo image, and legal filing number required by law.This information is usually managed in the background global settings to ensure consistency across the entire site and facilitate maintenance.AnQiCMS's powerful template tag system, especiallysystemLabels make it very intuitive and efficient to retrieve and display these global settings in the template.

Understanding global settings andsystemTag

AnQiCMS categorizes some of the core configurations of the website as "Global Settings", which, once modified, will immediately affect all pages of the website. To flexibly call this information in the template, the system provides a specialsystem.

systemThe basic usage of tags is:{% system 变量名称 with name="字段名称" %}.

Here变量名称is an optional parameter, you can use it to temporarily store the obtained setting values, so that they can be reused in templates or undergo more complex processing.nameThe parameter specifies the field name of the specific global setting item you want to retrieve, for exampleSiteNameUsed for website name,SiteLogoUsed for website logo, etc.

Get and display the website name (SiteName)

The website name is the facade of the website and usually appears on the page<title>Labels, headers, footers, and other key positions. After configuring the "Website Name" in the "Global Settings" of AnQiCMS backend, you can obtain it in the template using the following method:

<title>{% tdk with name="Title" siteName=true %}</title>
{# 或者,如果你只想获取网站名称本身,不带页面标题和分隔符 #}
<h1>{% system with name="SiteName" %}</h1>

In the above example,{% tdk with name="Title" siteName=true %}Is a better practice to get the page title, it will automatically concatenate the current page title and website name, and provide options for separators. If your website name is included in the HTML content (for example, with emphasis tags), you may also consider using|safeA filter to avoid HTML entity escaping.

Get and display the website logo (SiteLogo)

The website logo is the visual symbol of the brand, almost every website will display it in the header section. Assuming you have uploaded the website logo image in the "Global Settings" backend, it will be very simple to display it in the template:

<div class="header-logo">
    <a href="{% system with name="BaseUrl" %}">
        <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
    </a>
</div>

In this example, we not only obtained the path of the Logo image (SiteLogo), but also wrapped it in a link pointing to the homepage of the website (BaseUrl)。For SEO friendliness and accessibility, we useSiteNameasaltthe value of the attribute.

Get and display the filing number (SiteIcp)

For websites operating in mainland China, the filing number is a legal requirement that must be displayed as information, usually placed at the footer of the website. After filling in the 'Filing Number' in the 'Global Settings' of AnQiCMS backend, you can display it in the template like this:

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

Here, the record number is placed in a link that points to the Ministry of Industry and Information Technology record query website and is added withrel="nofollow"andtarget="_blank"properties, all of which are common web development practices.

Get and display the copyright information (SiteCopyright)

Copyright information is also a common element in the website footer, which protects the legal rights of the content. After filling in "Copyright Content" in the background "Global Settings", it can be displayed like this in the template:

<div class="footer-copyright">
    {% system siteCopyright with name="SiteCopyright" %}
    {{ siteCopyright|safe }}
</div>

It is noteworthy that the copyright information you enter in the background may contain HTML tags (such as&copy;symbols, links, etc.), then when using{% system siteCopyright ... %}{{ siteCopyright }}you need to add extra|safeFilter. This is because the AnQiCMS template engine defaults to escaping output variables with HTML entities to prevent XSS attacks.|safeThe filter tells the template engine that this content is safe and does not need to be escaped, ensuring that the HTML content is rendered correctly.

Get other commonly used global settings and custom parameters

In addition to the above core settings,systemtags can also obtain more preset global information, such as:

  • Website home page address (BaseUrl): {% system with name="BaseUrl" %}It is usually used to construct absolute path links.
  • Template static file address (TemplateUrl): {% system with name="TemplateUrl" %}Convenient for referencing CSS, JS, and other static resources under the template directory.
  • Site Language (Language): {% system with name="Language" %}Can be used to set the HTML'slangproperties, such as<html lang="{% system with name='Language' %}">.

The strength of AnQiCMS lies in its ability to add in the background "Global Settings"Custom parameter. If your website needs to display some global information without predefined fields (such as 'customer service phone number', 'company email' etc.), you can add a custom parameter in the background, for example, with the parameter nameCustomerPhone. Then you can access it in the template{% system with name="CustomerPhone" %}This provides great convenience for the flexibility and scalability of the template.

Summary

By flexible applicationsystemTags, AnQiCMS makes the call to the global settings of the website extremely simple and efficient.It not only simplifies the template development process, but more importantly, ensures the consistency of website information, facilitates future content updates and multi-site management, and thus builds a stronger and easier to maintain website.


Frequently Asked Questions (FAQ)

  1. Ask: Why isn't my website logo or filing number displayed, or is displayed incorrectly?Answer: Firstly, make sure you have correctly filled in the 'Website Logo' and 'Record Number' information in the 'Global Settings' of the AnQiCMS background.For the logo, you also need to check if the path of the image you uploaded is valid.If the image path is correct but it still does not display, it may be a browser cache issue. Try clearing the browser cache and refreshing the page.Moreover, if you are a multi-site user, please confirm whether the template needs to be approved throughsiteIdThe parameter specifies the settings for a specific site.

  2. Ask: Can I get other custom global information besides the preset website name, Logo, etc.?Of course you can. AnQiCMS allows you to add custom parameters on the "Global Settings" page in the backend.For example, you can add a parameter named 'Customer Service Phone Number' with the field name (for template calls) ofCustomerServicePhoneIn the template, you can use{% system with name="CustomerServicePhone" %}Get and display this custom information. This greatly increases the flexibility of the template.

  3. Question: If I manage multiple sites, how can I get the global settings of different sites in the template?Answer: AnQiCMS'systemTag supportsiteIdParameter. If you want to get the global settings of a specific site (not the current site), you cansystemExplicitly specify in the tagsiteIdFor example,{% system with name="SiteName" siteId="2" %}It will retrieve the website name of the site with ID 2. This is very useful for building shared modules or cross-referencing information under multi-site management.

Related articles

On the article detail page, how to obtain and display a list of recommended articles related to the current article?

In website content operation, improving user stay time and reducing bounce rate is the goal pursued by every operator.After a user reads an article, if they can immediately see other content that interests them, it will undoubtedly greatly enhance their engagement, thereby improving the overall interactivity and user experience of the website.While AnQiCMS (AnQiCMS) is a powerful content management system, it provides us with convenient tools to implement intelligent recommendations for article detail pages without complex development work.The list of recommended articles not only provides users with a deeper reading experience, but also guides them to browse more website content

2025-11-08

How to control the article list to only display documents under the current category and not include content from its subcategories?

When managing website content in Anqi CMS, we usually organize articles into different categories to form a clear hierarchical structure.This structure provides great convenience when managing content in the background.However, when displaying the list of articles on the front-end page, we sometimes need to control the display range of content more accurately, for example, we only want to display the articles directly published under the current category, and not include the content of its subcategories.Luckyly, AnQi CMS provides a simple and powerful solution for this: using the `archiveList` template tag's `child`

2025-11-08

How to define a new field in a custom content model and flexibly call and display these fields on the front-end page?

In AnQi CMS, using a custom content model to manage and display personalized content is one of its core strengths.This allows us to flexibly create dedicated data structures for different types of content according to specific business requirements.This article will discuss in detail how to define these custom fields in the background, as well as how to cleverly call and display them on the frontend page. ### Define a new field in the backend content model The content model is like a "blueprint" for content, it determines what information each type of content (such as articles, products, cases, etc.) should include. To define a new field

2025-11-08

How can AnQi CMS display image watermarks or anti-crawling interference codes on the front end to protect original content?

In the current information explosion of the Internet environment, the value of original content is increasingly prominent.However, content plagiarism and malicious scraping have also become a major headache for many website operators, not only damaging the creators' labor results, but also possibly affecting the website's search engine rankings and brand reputation.Faced with this challenge, AnQiCMS (AnQiCMS) fully understands the importance of content protection, and is built-in with front-end image watermarking and anti-crawling interference code functions, aiming to provide a solid defense line for your original content.### Understand the necessity of content protection Before discussing specific features

2025-11-08

How to obtain and display the contact information configured on the back-end, such as phone numbers, email addresses, WeChat QR codes, and other diversified information?

AnQiCMS (AnQiCMS) is an efficient and flexible content management system that excels in helping enterprises display their brand image and provide convenient communication channels.For any website, having clear and easily accessible contact information is crucial for building trust with users and promoting cooperation.AnQi CMS deeply understands this, providing a set of intuitive and powerful functions that allow you to easily manage and display various contact information such as phone numbers, email addresses, WeChat QR codes, etc.### Backend Configuration: Central Management Center for Contact Information In AnQi CMS

2025-11-08

How to use the article's `flag` attribute (such as 'Top Story', 'Recommendation') to filter and highlight specific content?

In AnQi CMS, efficiently managing and highlighting specific content is the key to website operation success.When the content of the website becomes increasingly rich, how to ensure that important information can quickly attract the attention of visitors and guide them to browse the core content, which has become a problem that every operator needs to think deeply about.The Anqi CMS provides a powerful "recommendation attribute" (flag) feature that allows you to easily filter and highlight specific content, thereby enhancing user experience and website operation effects.### Understanding the `flag` attribute of Anqi CMS The `flag` attribute, as the name suggests

2025-11-08

How to receive and display custom form fields from the backend in a frontend comment form?

In website operation, the message form is an important channel for interacting with users, collecting feedback and leads.AnQiCMS provides flexible comment functions, one very practical ability is to allow us to customize form fields in the background, and seamlessly present them in the front-end comment form to meet the personalized information collection needs of different business scenarios.Next, we will discuss in detail how to implement this feature in Anqi CMS.### One, define the custom message field in the background First, we need to enter the Anqi CMS backend management interface

2025-11-08

How to format an article's publish timestamp into a user-friendly date and time format, such as '2023 January 01 14:30'?

User-friendly date and time display is crucial for website content.A clear and readable time format not only improves the visitor's reading experience, but also helps them quickly understand the publishing or updating timeliness of the content.In AnQiCMS, formatting the publication timestamp of articles into a format such as '2023-01-01 14:30' is both flexible and efficient.Understanding the use of timestamps in AnQiCMS In the content managed by AnQiCMS, whether it is articles, products, or other custom models

2025-11-08