In the operation of AnQiCMS website, the footer of the website usually carries important information, among which the copyright statement is not only a legal requirement, but also a reflection of the brand's professionalism.An clear and dynamic copyright information that can enhance the professional image of the website and provide basic protection for the content.In AnQiCMS, managing and displaying website custom copyright information is a very intuitive and flexible operation.

Next, we will introduce how to set and display your custom copyright information in the AnQiCMS template.


Part 1: Configure the copyright content in the AnQiCMS backend

Firstly, we need to set the copyright statement of your website in the AnQiCMS backend management interface. This process is very simple.

  1. Log in to the backend and navigate to global settings:Log in to your AnQiCMS admin panel, find and click on in the left menu, then select .

  2. Enter the copyright information:In the [Global Settings] page, you will see an input box named [Copyright Information].Here, you can freely fill in the content of the copyright statement according to your own needs.&copy; 2023 您的公司名称. All Rights Reserved.English. 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>Label emphasizes the company name. This provides greater flexibility for displaying copyright information.

    AnQiCMS will save the content you enter as is and make it available for you to call at any time in the front-end template.


Section 2: Call copyright information in the template file

Configure the copyright content on the backend first, and the next step is to display it in the frontend template of the website. The copyright information is usually located at the footer of the website, so you need to modify the footer file of the current template being used (for example,bash.htmlorfooter.htmlEnglish, the specific file path may vary depending on the template you choose to edit.)

AnQiCMS's template system uses syntax similar to Django template engine,systemTags can easily obtain various global information from the background settings, including the copyright information we just configured.

  1. Basic calling method:To display the copyright content you entered 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 [Copyright Information] input box on the background.

  2. English display of the current year:Considering that copyright statements usually need to include the year, and the year needs to be updated annually, AnQiCMS provides a very convenientnowLabel to dynamically retrieve the current year. This way, you do not need to manually modify the year in the template every year. To get the current year, you can use:

    {% now "2006" %}
    

    Here are the"2006"Is the standard reference time used in Go language for formatting date and time, representing the year.

  3. Combined with HTML tags and security filters:If you entered HTML tags in the background [Copyright Information] (such as<a>links or<strong>Emphasize tags), so that the browser can correctly parse and display these tags, we need to add an extra parameter when calling it.|safeFilter. This filter tells the template engine that this content is safe and does not require HTML escaping.

    For example, if you enter the [Copyright Information] in the background版权所有 <a href="https://www.yourcompany.com">您的公司名称</a>Then, when calling in the template, you can write it like this:

    {% system siteCopyright with name="SiteCopyright" %}
    <p>{{ siteCopyright|safe }} &copy; {% now "2006" %}.</p>
    

    Here, we first use the {% system siteCopyright with name="SiteCopyright" %}Assign the copyright content from the background to a variable namedsiteCopyrightand then,<p>use a control character inside{{ 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. Practical application examples

Combine the above knowledge points, a common and professional footer copyright area may look like this:

Assuming you have filled in the following in the [Global Settings] of the [Copyright Information] in the AnQiCMS background:<strong>我的品牌公司</strong>

Then, in the footer file of your template (for example,/template/您的模板目录/bash.htmlIn the parenthesis, you can write code like this:

<footer class="site-footer">
    <div class="container">
        <!-- 动态版权信息 -->
        {% system copyrightInfo with name="SiteCopyright" %}
        <p>
            {{ copyrightInfo|safe }} &copy; {% 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>

Through such settings, your website footer will be dynamically displayed<strong>我的品牌公司</strong> &copy; [当前年份]. All Rights Reserved.And the registration number, friend links and other information will be automatically displayed according to the backend configuration, without the need to manually modify the template code, which greatly improves the maintainability of the website.


Common Questions (FAQ)

  1. Q: Why does the copyright information I set in the background not display or display incorrectly on the front end?A: Please check first if 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 you added them when calling|safeFilter, such as{{ copyrightInfo|safe }}. Finally