In AnQiCMS website operation, the footer of the website usually carries important information, where the copyright statement is not only a legal requirement, but also an embodiment of brand professionalism.A clear and dynamically updated copyright information that can enhance the professional image of the website and provide basic protection for the content.In AnQiCMS, managing and displaying custom copyright information on the website is a very intuitive and flexible operation.
Next, we will learn in detail how to set and display your custom copyright information in the AnQiCMS template.
1. Configure the copyright content in the AnQiCMS background.
Firstly, we need to set the copyright statement of your website in the AnQiCMS backend management interface. This process is very simple.
Log in to the backend and navigate to the global settings:Log in to your AnQiCMS backend, find and click on 【Backend Settings】in the left menu, and then select 【Global Settings】.
Enter copyright information:In the [Global Settings] page, you will see a text box named [Copyright Information].In here, you can freely fill in the copyright statement content according to your own needs.For example, you can enter:
© 2023 您的公司名称. All Rights Reserved.It is worth mentioning that AnQiCMS allows you to include simple HTML tags in the 【Copyright Information】, such as adding a link to your company's official website or using<strong>The label emphasizes the company name. This provides greater flexibility for displaying copyright information.AnQiCMS will save your input content as is and make it available for you to call at any time in the front-end template.
Second, call the copyright information in the template file.
After configuring the copyright content on the backend, the next step is to display it in the website's frontend template. The copyright information is usually located at the footer of the website, so you need to modify the footer file of the template you are using (for examplebash.htmlorfooter.htmlThe specific file path may vary depending on the template you choose to edit.
AnQiCMS's template system uses a syntax similar to Django template engine, throughsystemLabels can easily retrieve various global settings of the background, including the copyright information we just configured.
Basic calling method:To display the copyright content you have filled in the background [Global Settings], just use the following tag code:
<div>{% system with name="SiteCopyright" %}</div>This code will directly output the content saved in the background [Copyright Information] input box.
Display the current year:Considering that copyright statements usually need to include the year, and the year needs to be updated every year, AnQiCMS provides a very convenient:
nowLabel to dynamically obtain the current year. This way, you do not need to manually modify the year in the template every year. To obtain the current year, you can use:{% now "2006" %}Here
"2006"It is the standard reference time used in Go language for formatting date and time, representing the year.Combined with HTML tags and security filters: If you enter HTML tags in the background's 【Copyright Information】 (for example
<a>links or<strong>Emphasize tags), in order for the browser to correctly parse and display these tags, we need to add them an extra call when invoking|safeA filter that tells the template engine that this content is safe and does not need to be HTML-escaped.For example, if you entered the copyright information in the background
版权所有 <a href="https://www.yourcompany.com">您的公司名称</a>As such, when calling it in the template, it can be written like this:{% system siteCopyright with name="SiteCopyright" %} <p>{{ siteCopyright|safe }} © {% now "2006" %}.</p>Here, we first use
{% system siteCopyright with name="SiteCopyright" %}Assign the copyright content from the background to a variable namedsiteCopyright, and then<p>Use within tags{{ siteCopyright|safe }}Output and ensure that the HTML content is parsed correctly. At the same time, combine{% now "2006" %}Dynamically insert the current year.
3. Actual application examples
Combining the above knowledge points, a common and professional footer copyright area may look like this:
Assume you filled in the: Copyright Information under the Global Settings in the AnQiCMS backend<strong>我的品牌公司</strong>
Then, in the footer file of your template (such as/template/您的模板目录/bash.htmlYou can write code like this in Chinese:
<footer class="site-footer">
<div class="container">
<!-- 动态版权信息 -->
{% system copyrightInfo with name="SiteCopyright" %}
<p>
{{ copyrightInfo|safe }} © {% now "2006" %}. All Rights Reserved.
</p>
<!-- 其他页脚信息,例如备案号 -->
{% system icpInfo with name="SiteIcp" %}
{% if icpInfo %}
<p>
<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{{ icpInfo }}</a>
</p>
{% endif %}
<!-- 友情链接等 -->
{% linkList friendLinks %}
{% if friendLinks %}
<div class="friend-links">
友情链接:
{% for link in friendLinks %}
<a href="{{ link.Link }}" {% if link.Nofollow == 1 %} rel="nofollow"{% endif %} target="_blank">{{ link.Title }}</a>
{% endfor %}
</div>
{% endif %}
</div>
</footer>
By making such settings, your website footer will be dynamically displayed<strong>我的品牌公司</strong> © [当前年份]. All Rights Reserved.And the filing number, friend links and other information will be automatically presented according to the background configuration, there is no need to manually modify the template code, which greatly improves the maintainability of the website.
Frequently Asked Questions (FAQ)
- Q: Why is the copyright information I set in the background not displayed or displayed incorrectly on the front end?A: Please check first whether you have used the correct tags in your template file.
{% system with name="SiteCopyright" %}Call it. Also, if your copyright information contains HTML tags, make sure to add them when calling|safea filter such as{{ copyrightInfo|safe }}Finally