How to get and dynamically display the website name, Logo, and copyright information through template tags?

Calendar 👁️ 98

In AnQiCMS, efficiently managing the core information of a website is the key to building a flexible and easy-to-maintain website.The website name, logo, and copyright statement are important components of brand image and legal statements, and they usually need to be consistent across multiple pages of the website.AnqiCMS powerful template tag system, especiallysystemTags provide a concise and effective way to dynamically retrieve and display this information, greatly enhancing the development efficiency and maintenance convenience of the website.

UnderstandingsystemThe core role of template tags.

In the AnqiCMS backend "Global Function Settings", you can configure a series of basic information about the website, including the website name, Logo image, filing number, and copyright information.systemThe template tag is the 'representative' of these global settings in the front-end template. It allows you to specifynameAccess these predefined field values. This means that once you modify this information in the background, all callssystemof the label pages will be automatically updated without manually modifying the template code.

systemThe basic format of tags is{% system 变量名称 with name="字段名称" %}. Among them,变量名称It is optional. If you specify it, the value obtained will be stored in this variable for use in subsequent template logic; if you omit it变量名称If the label is directly output, it will display the value of the corresponding field.nameThe attribute is the identifier of the specific setting item you want to obtain, corresponding to each field in the background settings.

Dynamically display the website name (SiteName)

The website name is the most direct way to identify the website identity and usually appears on the web page.<title>In labels, as well as in prominent positions such as the header and footer. In the AnqiCMS background 'Global Function Settings', the configured 'Website Name' corresponds to the template tag inSiteNamefield.

For example, if you want to display the website name in the page title, you can use it like this:

<title>{% system with name="SiteName" %}</title>

If you want to use the website name as a title for a part of the page and assign it to a variable for use in multiple places, you can do it like this:

{% system mySiteName with name="SiteName" %}
<header>
    <h1>欢迎来到 {{ mySiteName }}</h1>
</header>

This way, no matter how you modify the website name in the background, the front-end page will update in real time.

Dynamically display the website logo (SiteLogo)

The website logo is the visual symbol of the brand, its display is crucial for brand recognition.AnqiCMS allows you to upload website Logo image in the background "Global Function Settings".In the template,systemTag throughSiteLogoField, can get the URL address of the Logo image.

When displaying the Logo image in HTML, it is usually combined with<img>Label. It is recommended to use it simultaneously for SEO and accessibilityaltAttribute to describe the image content, herealtThe attribute value can also dynamically obtain the website name.

This is an example of displaying a website logo:

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

If you are used to storing the logo address in a variable before using it, you can do it like this:

{% system siteLogoPath with name="SiteLogo" %}
<div class="brand-identity">
    <a href="/">
        <img src="{{ siteLogoPath }}" alt="网站Logo图片">
    </a>
</div>

Dynamic Display of Copyright Information (SiteCopyright)

Copyright information is usually located at the footer of a website, used to declare the ownership of the content. You can find the 'Copyright Information' setting in the 'Global Function Settings' of the AnqiCMS backend, which corresponds to the template.SiteCopyrightfield.

Due to copyright information that may contain HTML tags such as&copy;symbols, links, etc.), it is recommended to use|safeA filter to ensure that this HTML content is parsed correctly by the browser and not displayed as plain text.

Here is an example of a footer displaying copyright information.

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

Or, if you need to handle copyright information more complexly, you can assign it to a variable first:

{% system copyrightContent with name="SiteCopyright" %}
<div class="footer-legal">
    {{ copyrightContent|safe }}
    <span class="current-year">© {% now "2006" %}</span> <!-- 结合当前年份标签 -->
</div>

By|safeThe filter, you can ensure that any HTML content entered in the background can be correctly rendered on the front end. At the same time, you can also combinenowTags to dynamically display the current year, making the copyright information more perfect.

Summary

AnqiCMS'ssystemTemplate tags are the core tools for dynamically displaying global information on the website front-end.It decouples the website name, Logo, copyright information, and other key configurations from the template content, realizing a convenient management mode of one-time configuration and full-site update.This significantly improves the development efficiency and operational flexibility of the website, and also lays a solid foundation for ensuring the consistency of website information, enhancing user experience, and optimizing search engine rankings.Proficient in usingsystemTags, you will be able to build and manage a high-quality AnqiCMS website more easily.

Frequently Asked Questions (FAQ)

  1. Why did my website logo image upload but not display on the page?

    • Firstly, make sure that the Logo image has been successfully uploaded and saved in the 'Global Function Settings' of the AnqiCMS backend.
    • Secondly, check the call in your template.{% system with name="SiteLogo" %}Does the code work correctly, especiallysrcProperty.
    • Finally, it may be due to browser cache. Try clearing the browser cache or refreshing the page forcibly (Ctrl+F5 or Cmd+Shift+R) to see the effect.If it still cannot be displayed, please check if the image path is correct or if there are permission issues.
  2. I entered the copyright information in the background&copy; 2023 All Rights ReservedBut the front-end page displayed it directly&amp;copy; 2023 All Rights ReservedWhat's the matter?

    • This is because AnqiCMS (and many template engines) defaults to escaping HTML content to prevent potential security issues (such as XSS attacks).When you use HTML entities or tags in the copyright information, you need to inform the template engine that this content is safe and does not need to be escaped.
    • The solution is to callSiteCopyrightUse when a field|safefor example:{% system with name="SiteCopyright" %}|safe}}.
  3. If my website is multilingual or multi-sitesystemWill the tag still work? Do I need to configure it separately for each site?

    • systemTags are usually aimed at obtaining information for the current site or language environment. If you have enabled the multi-site feature of AnqiCMS and each site has an independent backend setting, then in the corresponding site template,systemThe tag automatically retrieves the configuration information of the current site.
    • systemTags also supportsiteIdParameters (for example{% system with name="SiteName" siteId="2" %}This is used in special cases for cross-site data calls, but it is usually an advanced usage that does not need to be specified manually.In a multi-site or multi-language environment, AnqiCMS will intelligently handle it for you.

Related articles

How to ensure that template files do not display乱码 when displayed on the page in AnQi CMS?

When using AnQi CMS to manage website content, if you suddenly find that the text on the page becomes strange and turns into unreadable symbols, which is what we often call 'garbled code', it is undoubtedly very annoying.The root cause of page garbled characters is usually inconsistent file encoding and browser parsing encoding.In Anqi CMS, ensure that template files are displayed normally, avoid garbled text, and the key is to understand and correctly handle the encoding of template files.The AnQi CMS has specific requirements for the encoding of template files, it needs to use **UTF-8 encoding** uniformly

2025-11-08

What types of template display modes does AnQi CMS support (such as adaptive, code adaptation)?

How to ensure that the content is perfectly displayed on different devices when building a website is a problem that every operator needs to consider.A safe CMS knows this, therefore it provides various flexible template display modes to help us choose the most suitable website presentation method according to our actual needs. The template display mode of AnQi CMS mainly includes three types: adaptive, code adaptation, and independent PC + mobile site.Understand their respective features and application scenarios, which can help you better plan the user experience and SEO strategy of the website.

2025-11-08

How to set a dedicated display template for articles, products, or single pages in AnQi CMS?

In Anqi CMS, in order to make your website content more personalized and visually appealing, you can set exclusive display templates for different types of articles, product detail pages, or independent single pages.This can not only improve the user experience, but also facilitate differentiated operation for specific content.The Anqi CMS provides a flexible mechanism to achieve this goal, whether it is for all content under a specific category, a specific article or product, or an independent page, you can find a suitable template customization solution.

2025-11-08

How to customize the overall layout and display structure of the website front-end page in AnQi CMS?

## Flexible Mastery: How Anqi CMS Creates Personalized Website Front-end Layout and Display Structure In the digital age, the front-end design of a website is crucial for user experience and brand image.An efficient content management system that not only can easily manage content but also can flexibly customize the overall layout and display structure of the front-end page.AnQi CMS is well-versed in this, providing us with a powerful and intuitive toolkit that makes website customization accessible.

2025-11-08

How to implement multi-language content switching and correct display for different users in AnQi CMS?

Today, with the deepening of globalization, companies and content operators often need to reach users from different language backgrounds.An efficient content management system that can simplify the publishing and management of multilingual content will undoubtedly greatly enhance operational efficiency.AnQiCMS (AnQiCMS) provides a very practical solution at this point, helping users easily switch between languages and display content correctly.### The core concept of AnQiCMS building multilingual websites AnQiCMS regards multilingual support as one of its core features, aiming to help enterprises expand into the international market

2025-11-08

How to optimize the Anqi CMS URL structure to improve the search engine's crawling and display effect?

When we manage our own website content, the link (URL) in the address bar is often a detail that is easily overlooked.However, a clear and organized URL structure not only makes it easier for visitors to understand the content of the page, but also lays the foundation for search engines to effectively crawl and display website information.A good URL can not only improve user experience but also directly affect the performance of a website in search results.AnQiCMS was designed with SEO needs in mind from the beginning, providing rich tools and flexible configuration options

2025-11-08

How to get and display the title, content, thumbnail, and publish time on the article or product detail page?

When using Anqi CMS to manage website content, whether it is to publish new articles, update product details, or build list pages, one of the core tasks is to accurately and efficiently display the title, content, thumbnail, and publish time of the content.AnQi CMS provides concise and powerful template tags, making these operations intuitive and easy to understand.This article will introduce in detail how to flexibly obtain and present these key information on your website page, ensuring that the content display is both beautiful and practical.

2025-11-08

How to ensure that the content of the article is rendered correctly as HTML on the front-end page if it uses Markdown format?

In Anqi CMS, master Markdown: Ensure content is elegantly rendered as HTML Markdown, as a lightweight markup language, is increasingly favored by content creators for its simplicity, efficiency, and ease of use.It allows us to focus on the content itself without being distracted by complex layout tools.

2025-11-08