When operating a website, the filing number and copyright information are an indispensable and important part of the website. They are not only the symbol of the legal operation of the website, but also reflect the respect for original content.For AnQiCMS users, managing this information and displaying it dynamically through the footer is a convenient and efficient operation.AnQiCMS provides an intuitive backend setting and flexible template tags, allowing you to easily meet this requirement and save the trouble of manually modifying each page code.

Back-end centralized configuration of filing number and copyright information

Firstly, you need to set your website filing number and copyright information in the AnQiCMS backend management interface.This centralized management approach means that once you complete the settings on the backend, this information can be automatically applied to all the places on the website that need to be displayed, greatly improving management efficiency.

  1. Enter Global Function Settings:Log in to the AnQiCMS admin panel, navigate to the left menu's 'Admin Settings', and then select 'Global Function Settings'. Here you will find the core configuration options of the website.
  2. Fill in the record number:In the "Record Number" field, please fill in your website record number accurately.AnQiCMS in template calls usually uses this information to automatically generate a link to the Ministry of Industry and Information Technology government service platform (beian.miit.gov.cn), ensuring compliance.-1with suffixes, the system will handle it intelligently.
  3. Enter copyright information:In the "Copyright InformationAll Rights Reserved.”This field supports HTML content, which means you can add simple formatting tags, such as bold, links, etc., to enrich the display effect.

Complete the entry of these two items and save, and you have established a unified data source for the website's filing number and copyright information.

UtilizesystemDynamic display of tags

AnQiCMS's template system is powerful and easy to use, it dynamically retrieves background data through a series of tags. For the filing number and copyright information, we mainly rely onsystemLabel.

systemThe design purpose of the label is to obtain the global configuration information of the website. Its basic usage method is{% system 变量名称 with name="字段名称" %}.

Dynamically display the website filing number

The record number usually needs to be linked to the website of the relevant national department to verify its authenticity. AnQiCMS providesSiteIcpthe field to obtain the record number filled in the background.

In your footer template file (usually)templatethe directory.partial/footer.htmlorbash.htmletc. public templates), you can write code like this:

<p>
    {% system siteIcp with name="SiteIcp" %}
    {% if siteIcp %}
    <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{{ siteIcp }}</a>
    {% endif %}
    <!-- 更多备案相关信息可以放在这里 -->
</p>

This code first uses{% system siteIcp with name="SiteIcp" %}Assign the record number set in the background tositeIcpthe variable. Then, through a{% if siteIcp %}Ensure that the output is only made when the filing number exists. Finally, wrap the filing number in a tag and link it to the Ministry of Industry and Information Technology's government service platform.<a>the tag and link it to the Ministry of Industry and Information Technology's government service platform.rel="nofollow"andtarget="_blank"Properties, to optimize SEO and user experience.

Dynamically display copyright information

The copyright information is typically a simple text statement, but it may sometimes contain HTML tags (such as bold, links). AnQiCMS providesSiteCopyrightField to obtain the copyright information filled in by the background.

Due to copyright information may contain HTML content, in order to ensure that these HTML tags can be properly parsed by the browser instead of being displayed as plain text, we need to use|safeFilter.

In your footer template file, you can write the code like this:

<div class="footer-copyright">
    {% system siteCopyright with name="SiteCopyright" %}
    {% if siteCopyright %}
    {{ siteCopyright|safe }}
    {% else %}
    <p>&copy; {% now "2006" %} 版权所有. All Rights Reserved.</p> {# 如果后台未设置,则显示默认信息 #}
    {% endif %}
</div>

Here, we also useSiteCopyrighttositeCopyrighta variable, and through{% if siteCopyright %}to determine if it exists. If it exists,{{ siteCopyright|safe }}It will securely output the copyright information set in the background (including the HTML tags) to the page. If no copyright information is set in the background, we provide a default copyright statement, which includes:{% now "2006" %}Will dynamically retrieve the current year.

Integrate the code into the footer template

In AnQiCMS, the website footer is usually an independent template file, as mentioned previously, it may be located intemplate/default/partial/footer.htmlor astemplate/default/bash.html(Basic skeleton template) part. You just need to paste the code snippet of the filing number and copyright information into the corresponding position in the actual footer template file of your website.

For example, a typical footer structure may contain the following content:

<footer>
    <div class="container">
        <!-- 其他页脚内容,如联系方式、友情链接等 -->

        <div class="footer-info">
            <p>
                {% system siteIcp with name="SiteIcp" %}
                {% if siteIcp %}
                <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{{ siteIcp }}</a>
                {% endif %}
            </p>
            <div class="footer-copyright">
                {% system siteCopyright with name="SiteCopyright" %}
                {% if siteCopyright %}
                {{ siteCopyright|safe }}
                {% else %}
                <p>&copy; {% now "2006" %} 版权所有. All Rights Reserved.</p>
                {% endif %}
            </div>
        </div>
    </div>
</footer>

In this way, the filing number and copyright information of your website will be automatically dynamically retrieved and displayed in the website footer from the background. In the future, whether it is to modify the filing number or update the copyright year, it only needs to be done once in the background, without touching the code, maintaining the consistency and convenience of website content management.


Common Questions and Answers (FAQ)

1. Why is the HTML tag in my copyright information not parsed but displayed directly on the page instead?

This is usually because you haven't specifiedSiteCopyrightto use the output of|safeFilter.AnQiCMS template system defaults to escaping all output content to prevent cross-site scripting (XSS) attacks.<b>or<a>and hope they are parsed by the browser, then you must add when outputting variables|safeFilter, for example{{ siteCopyright|safe }}.

2. How to ensure that the record number link points correctly to the national record query platform?

In the background "Global Function Settings", when filling in the record number, you only need to enter the pure record number string. As shown in the article example, you need to manually construct a<a>Label, ithrefproperty is set tohttps://beian.miit.gov.cn/and the dynamically obtained record number is wrapped as link text. AnQiCMS defaults to not automatically wrappingSiteIcpGenerate external link, which requires you to define it in the template so that you can fully control the style and properties of the link (such astarget="_blank"andrel="nofollow").

3. If I operate multiple sites with different record numbers and copyright information, how to manage them?

AnQiCMS supports multi-site management, each site has its own independent backend configuration.Therefore, you just need to switch to the corresponding site backend, and then configure the record number and copyright information in the "Global Feature Settings" of the site.systemLabels will automatically retrieve the global configuration information of the current site and display it, without the need to modify the template code.