How to dynamically display the website filing number and copyright information through the `system` tag in the footer?

Calendar 👁️ 77

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.

Related articles

How to use the `system` tag to display the website name and logo on the page?

## Easily Solved: How to Gracefully Display Your Website Name and Logo on AnQiCMS Page It is crucial to display brand identity when operating a website.The website name and logo are not only the key elements for visitors to identify your brand, but also the foundation for enhancing the professionalism and trust of the website.AnQiCMS provides a直观而强大的template tag system that allows you to easily call and display these core information on any page of the website.Among them, the `system` tag is specifically designed to obtain this type of global site configuration. Next

2025-11-08

How to implement the reuse of the common part of AnQiCMS templates (such as headers and footers)?

In AnQiCMS, efficient website content management is inseparable from a flexible and easy-to-maintain template system.You may encounter such a need when creating a template: headers, footers, navigation bars, and other common elements need to appear on every page of the website.If repeating the same code on each page is not only time-consuming and labor-intensive, but also modifying it in the future will cause a domino effect.Luckyly, AnQiCMS leverages the powerful functions of the Django template engine to provide an elegant solution, allowing these common parts to be easily reused.### Core Foundation

2025-11-08

How to flexibly specify independent display templates for single-page content?

AnQiCMS (AnQiCMS) provides excellent flexibility in website content management, especially in the display of single-page content, allowing us to specify completely independent display templates for different single pages.This means that your "About Us" page can have a unique layout and design, distinctly different from pages like "Contact Us" or "Terms of Service", without modifying the overall template structure of the website.This fine-grained control brings great freedom to the content presentation of the website.Many times, certain pages on our website carry important brand image displays

2025-11-08

How to use custom templates to display content for specific documents or categories?

In the daily operation of websites, the flexibility of content display is often the key to whether a website can stand out and meet the diverse needs of users.AnQiCMS (AnQiCMS) fully understands this point and provides powerful custom template features, allowing content to not only be efficiently managed but also presented in a way that conforms to brand characteristics and user habits. ## Unlock the Custom Template Ability of AnQi CMS AnQi CMS, as an enterprise-level content management system, has always focused on the customization needs of content display from the very beginning.

2025-11-08

How to conveniently display the company's contact phone number and address with the `contact` tag?

In website operation, clearly and conveniently displaying the company's contact information is a key link to enhance user trust and promote business communication.Whether it is to seek cooperation, provide customer support, or simply to let visitors understand the location of the company, contact information plays a vital role.AnQiCMS fully understands this and provides us with an extremely convenient way to manage and display this information through its powerful template tag system.

2025-11-08

How to dynamically generate the page's Title, Keywords, and Description (TDK) to optimize SEO display?

In website operation, Title (title), Keywords (keywords) and Description (description) - abbreviated as TDK, are the core elements of search engine optimization (SEO).They directly affect the display of the website on the search engine results page (SERP), thereby determining the click-through rate and traffic of the website.For a content-rich website, manually setting TDK for each page is neither realistic nor efficient.

2025-11-08

How to use the `navList` tag to build a website navigation menu with secondary dropdown?

Build a clear and easy-to-use website navigation menu is an important link to improve user experience and website professionalism.In AnQi CMS, we can take advantage of the powerful `navList` tag to easily implement a navigation menu with secondary dropdown support, making the website content well-structured and convenient for visitors to browse.Next, we will explore how to use the `navList` tag, from backend configuration to frontend template rendering, step by step to create a complete second-level dropdown navigation.

2025-11-08

How to automatically generate breadcrumb navigation using the `breadcrumb` tag and customize the display text on the homepage?

The user experience of a website largely depends on the convenience and clarity of navigation.When the visitor delves into the website content, a friendly 'Breadcrumb Navigation' can clearly indicate the current position and provide a quick path to return to the upper page.AnQiCMS is well-versed in this, providing a powerful and easy-to-use `breadcrumb` tag that allows website administrators to automatically generate paths without complex coding, and even to flexibly customize the display text on the homepage.

2025-11-08