The website footer usually carries important content such as copyright information, filing number, and more, which not only relates to the professional image of the website but is also the cornerstone of legal requirements and user trust.In AnQiCMS, these global settings can be configured and called very conveniently, making your website information clear at a glance.
We will learn in detail how to configure and display these key information in AnQiCMS.
Step 1: Configure global information in the background.
First, you need to log in to your AnQiCMS backend, find the left navigation bar's 【Background Settings】, and then click 【Global Function Settings】.Here, you will see a series of customizable global site information.
These settings items are directly related to copyright information and filing number:
- Website Name: It is usually used to display the brand name or part of the website title.
- Website LOGO: You can upload your website icon, which will be called to display in the template.
- Record numberIf your website has passed the Ministry of Industry and Information Technology filing, please fill in your filing number here. Please note that you only need to fill in the filing number itself, not including suffixes like “-1”.
- Copyright informationThis is a text area where you can fill in the copyright statement for the website, for example, “©2023 Your Company Name. All Rights Reserved.”, or any other copyright statement you wish to display.
Moreover, if you have any other information that needs to be displayed uniformly across the entire site, such as a specific slogan, contact information for a special project, or a link to a specific page, you can use the [Custom Settings Parameter] feature.Here, you can add new parameter items, set a 【parameter name】(it is recommended to use letters, which will be automatically converted to camel case by the system), enter the corresponding 【parameter value】, and a 【remark】for future management.The calling method of these custom parameters is similar to built-in parameters, greatly enhancing the flexibility of the system.
After completing the information entry, please make sure to click Save to ensure that your configuration takes effect.
Step two: Call the global settings content on the front page.
After configuring the background information, the next step is to display them on the front page of the website. Typically, these global information is placed in the footer of the website, or a universal header file, even likebash.htmlsuch a public code snippet.
The AnQiCMS template system provides powerfulsystemLabel to get this globally set content in the background. You can call them in your template files using the following method:
Display website nameThe website name usually appears in the title of the page (
<title>tags) or in the brand logo at the footer.<title>{% system with name="SiteName" %}</title> <!-- 或者在页面内容中 --> <span>欢迎访问 {% system with name="SiteName" %}</span>Display the website logoThe invocation of the website logo is usually combined with
<img>Tags, and it is recommended to set them at the same time for SEO optimization.altThe attribute is the name of the website.<img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />Display the record numberThe record number usually needs to be linked to the Ministry of Industry and Information Technology filing management system website.
<a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">{% system with name="SiteIcp" %}</a>here,
target="_blank"Means to open the link in a new window.rel="nofollow"Then tell the search engine not to track this link, which is a common SEO practice.Displays copyright informationThe copyright information you fill in the background can be called in the following way.
<div>{% system with name="SiteCopyright" %}</div>Special reminder: If your copyright information contains HTML tags (such as
<a>links or<b>bold text, etc.), in order to ensure that these tags are parsed correctly rather than displayed as plain text, you need to use|safea filter. For example:{% system siteCopyright with name="SiteCopyright" %} {{ siteCopyright|safe }}In the copyright information, we often need to display the current year. AnQiCMS provides a
nowtag to get the current time, and you can combine it to display the year:<div>版权所有 © {% now "2006" %} {% system with name="SiteName" %}. All Rights Reserved.</div>Here
"2006"Is a special string used in Go language for formatting years.Display custom parametersThe calling method is similar to built-in parameters for the parameters you customize in the background, just need to
nameSet the attribute to your custom parameter name (note the camel case naming rule). For example, if you have a parameter named "HelpUrl":{% system helpUrl with name="HelpUrl" %} <p>需要帮助?请访问我们的 <a href="{{helpUrl}}">帮助中心</a>。</p>
Tips and注意事项
- Select the template fileFooters are usually placed in a template named
footer.html. If your template uses a publicbash.htmlfile to include headers and footers, then the calling code will also be placed there. - Clear cacheAfter modifying the template file or backend settings, if the front-end page does not update immediately, please try clicking the Update Cache button in the upper right corner of the backend navigation bar, clear the system cache, and then refresh the page.
- Test compatibilityAfter completing the changes, it is recommended that you test on different browsers and devices to ensure that all information is displayed correctly and that the layout has not been affected.
By calling the above simple configuration and template code, you can easily display professional and compliant copyright information, filing number, and other global settings on the website built with AnQiCMS.The flexibility of AnQiCMS makes these operations easily accessible.
Frequently Asked Questions (FAQ)
Why did I add the label in the copyright information I set in the background,
<b>but the label showed up directly on the front page,<b>without bolding? AnswerThis is because AnQiCMS template engine, for safety, defaults to escaping output HTML tags to prevent XSS attacks. If your copyright information contains HTML tags and you want them to be effective, you need to use them when calling the content.|safeFilter. For example, to{% system with name="SiteCopyright" %}is modified to{% system siteCopyright with name="SiteCopyright" %}{{siteCopyright|safe}}Such that the template engine will treat it as safe content and normally parse HTML tags.Ask: I have modified the "website name" or "record number" in the background, but the front page seems to have no change after refreshing, what is the matter? AnswerThis is likely due to system caching. AnQiCMS caches some data to improve website access speed.When you modify the background settings but the front-end is not updated, you can try clicking the [Update Cache] button on the right side of the background navigation bar to clear the system cache.After cleaning up, refresh the front-end page again, and you should be able to see the latest content.
Ask: Besides copyright and record number, how should I operate if I want to display a custom social media link at the bottom of the website? AnswerYou can use the [Global Function Settings] under the [Custom Setting Parameters] feature. For example, you can add one named
FacebookLinkCustom parameter, set its [parameter value] to your Facebook homepage URL. Then in your template file (such asfooter.html), through{% system facebookLink with name="FacebookLink" %}{{facebookLink}}This way to call and generate the corresponding link, for example:<a href="{% system facebookLink with name="FacebookLink" %}{{facebookLink}}" target="_blank">Facebook</a>.