When operating a website, the filing number and copyright information are an indispensable part of the website. They are not only the mark of 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, saving you the trouble of manually modifying the code on each page.

Configure the filing number and copyright information centrally in the background

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 setup in the background, this information can be automatically applied to all the places on the website that need to be displayed, greatly improving management efficiency.

  1. Enter the global function settings:Log in to the AnQiCMS backend, navigate to the left menu's 'Backend Settings', then select 'Global Function Settings'. Here are the core configuration options of the website.
  2. Please fill in the record number:In the 'Record Number' field, fill in your website备案号 accurately.AnQiCMS usually uses this information to automatically generate a link to the Ministry of Industry and Information Technology's government service platform (beian.miit.gov.cn) during template calls, ensuring compliance.No manual addition required-1Suffixes, the system will handle it intelligently.
  3. Enter copyright information:In the "Copyright Information" field, you can enter the copyright statement of the website, for example "©"}2023 Your Company Name. All 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.

After completing and saving these two pieces of content, you have established a unified data source for the website filing number and copyright information.

UtilizesystemLabel Dynamic Display

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

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

Dynamically display the website filing number

The registration number usually needs to be linked to the website of the relevant national department to verify its authenticity. AnQiCMS providesSiteIcpa field to retrieve the registration number filled in the background.

In your footer template file (usuallytemplateUnder the directorypartial/footer.htmlorbash.htmland other common templates), you can write the 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 filing number set in the background tositeIcpa variable. Then, through a{% if siteIcp %}Determine, ensure that content is only output when the record number exists. Finally, wrap the record number in a<a>tag, link to the Ministry of Industry and Information Technology's government service platform, and addrel="nofollow"andtarget="_blank"Property, to optimize SEO and user experience.

Dynamically display copyright information.

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.

Since copyright information may contain HTML content, in order to ensure that these HTML tags are parsed correctly by the browser rather than 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 willSiteCopyrightthe value tositeCopyrightthe variable, and through{% if siteCopyright %}determine whether it exists. If it exists,{{ siteCopyright|safe }}Will output the copyright information set in the background (including the HTML tags) safely to the page. If no copyright information is set in the background, we provide a default copyright statement, which includes{% now "2006" %}Dynamically retrieves the current year.

Integrate the code into the footer template

In AnQiCMS, the website footer is usually an independent template file, as mentioned earlier, it may be locatedtemplate/default/partial/footer.htmlor astemplate/default/bash.htmlPart of the basic skeleton template. Simply copy the above record number and copyright information code snippet into the corresponding position of the footer template file used on your website.

For example, a typical footer structure may include 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 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 operated once in the background, without touching the code, maintaining the consistency and convenience of website content management.


Frequently Asked Questions (FAQ)

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

This is usually because you haven't set up the template correctly.SiteCopyrightoutput using|safeFilter. The AnQiCMS template system defaults to escaping all output content to prevent cross-site scripting attacks (XSS).If the copyright information you enter in the background contains HTML tags such as<b>or<a>and must be added when outputting the variable in order for the browser to parse them|safeFilter, for example{{ siteCopyright|safe }}.

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

When filling in the record number in the "Global Feature Settings" on the background, you only need to enter the pure record number string. As shown in the article example, you need to manually construct one in the template.<a>Label ithrefset the attribute tohttps://beian.miit.gov.cn/And the dynamic备案号 will be wrapped as link text. AnQiCMS defaults to not automatically doSiteIcpGenerate an 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. How to manage if I operate multiple sites, each with different filing numbers and copyright information?

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 filing number and copyright information respectively in the global feature settings of that site.When visiting a specific site,systemThe label automatically retrieves the global configuration information of the current site and displays it, without the need to modify the template code.