How to display website logo and copyright information in AnQiCMS template?

When building and operating a website, the website's logo and copyright information are an important part of forming the brand image, building user trust, and fulfilling legal statements.For AnQiCMS users, managing and displaying this information is very intuitive and flexible.

One, set the website logo and copyright information in the AnQiCMS background

AnQiCMS centralizes the global configuration of the website, allowing you to easily set various basic information.To set the website logo and copyright, you need to go to the "Global Function Settings" page in the background.

  1. Access the background settingsFirst, log in to your AnQiCMS admin interface. In the left navigation menu, find and click theBackend settingsSelect thenGlobal feature settings.
  2. Configure key information: On this page, you will see a series of settings related to the global functions of the website. Among them, there are several that we need to pay special attention to:
    • Website LOGOHere you are allowed to upload your website brand logo image.After uploading successfully, the system will store the image path for front-end template calls.A clear, appropriately sized logo can effectively enhance the professionalism of a website.
    • Copyright informationThis field is usually used to fill in your website copyright statement, for example “© 2023 Your company name. All Rights Reserved.”.It is worth noting that AnQiCMS takes into account that copyright information may contain HTML tags (such as bold, links, etc.), and therefore provides the corresponding handling method when calling the template.
    • Website Name: Although it is not a direct LOGO or copyright information, the website name is often used as the image LOGO of thealttext or displayed together with copyright information, enhancing SEO effects and user experience.
    • Record numberIf your website is registered, you can fill in the registration number here. This is usually displayed alongside the copyright information at the bottom of the website and will link to the Ministry of Industry and Information Technology's registration query website.

After completing the information entry and upload, remember to click the save button to ensure all changes have taken effect.

Secondly, display the website logo and copyright information in the AnQiCMS template.

After the background configuration is completed, the next step is how to display this information on the website's front page.AnQiCMS's template system adopts syntax similar to the Django template engine, making it easy to retrieve background data with simple tags.

1. Display website logo

You can use it to display the website logo you uploaded on the backend on the page.systemtags to retrieveSiteLogoThe value of the field. To improve the accessibility and SEO-friendliness of images, it is often combined withSiteNamethe field as the image'saltProperty.

You can find it in the template file (for example, usually in the public'sheader.htmlChinese) Write the code like this:

<a href="/">
    <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" class="site-logo" />
</a>
  • {% system with name="SiteLogo" %}This tag will directly output the URL address of the website logo image uploaded in the background "Global Feature Settings".
  • {% system with name="SiteName" %}This tag will output the website name you set as alternative text for the LOGO image (altProperties), very helpful when the image cannot be displayed, or for SEO and screen readers.
  • class="site-logo"This is an example of a CSS class name, you can customize it according to your template style to control the size, position, and other visual representations of the LOGO.

2. Display copyright information and filing number

Copyright information is usually placed at the bottom of a website. In addition to displaying the content of the 'Copyright Information' field, many websites also dynamically display the current year and link to the filing number.

You can place the footer section in the template file (for example, usually in the public section)footer.htmlChinese) Write the code like this:

<footer class="site-footer">
    <p>
        {% system siteCopyright with name="SiteCopyright" %}{{ siteCopyright|safe }}
    </p>
    <p>
        &copy; {% now "2006" %}
        {%- if siteIcp := system with name="SiteIcp" -%}
            <a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">{{ siteIcp }}</a>
        {%- endif -%}
    </p>
</footer>
  • {% system siteCopyright with name="SiteCopyright" %}This tag will retrieve the copyright statement text you have filled in the "Global Function Settings" on the backend. Here, we assign the content tositeCopyrightVariable.
  • {{ siteCopyright|safe }}:This is the key!If your copyright information includes HTML tags (such as when you fill in the background)<strong>or<a>In order for these HTML tags to be parsed correctly on the page rather than displayed as plain text, you need to use|safeFilter. It tells AnQiCMS and the browser that this content is safe and can be rendered directly as HTML.
  • &copy; {% now "2006" %}:&copy;is the copyright symbol, and{% now "2006" %}This label is very useful, it will automatically output the current year. This way, you do not need to manually update the copyright year every year, the system will keep it up to date automatically.
  • {%- if siteIcp := system with name="SiteIcp" -%}This is a conditional judgment statement. It first attempts to obtainSiteIcpthe value of the filing number and assign it tositeIcpa variable. IfsiteIcpit exists (i.e., you have filled in the filing number on the back end), then executeifThe content within the block.
  • <a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">{{ siteIcp }}</a>In the case of the condition being met, this line of code will create a link to the Ministry of Industry and Information Technology's filing query website, using the filing number you set as the link text.target="_blank"Open the link in a new window,rel="nofollow"Then tell the search engine not to track this link, which is a common SEO practice.

By using AnQiCMS flexible backend settings and powerful template tag system, you can easily and efficiently display LOGO and copyright information on your website, ensuring the unity of brand image and the completeness of legal information.


Frequently Asked Questions (FAQ)

1. Why does my website logo or copyright information not take effect immediately after I modify it in the template?This is usually due to browser cache or AnQiCMS system cache. You can try the following methods:

  • Clear the browser cachePress in your browser,Ctrl+F5(Windows/Linux) orCmd+Shift+R(macOS) perform a hard refresh, or manually clear the browser cache.
  • Update AnQiCMS system cache: Login AnQi