How to call and display the website logo image in AnQiCMS template?

Calendar 👁️ 75

In website operation, Logo is not only a visual identifier of the brand, but also an important part of the website's professionalism and user experience.AnQiCMS (AnQiCMS) provides an intuitive and easy way to manage and call the website logo, allowing you to easily display your brand image in every corner of the website.

This article will introduce you how to set your website logo in AnQi CMS backend, and guide you to accurately and flexibly call and display it in the front-end template, ensuring that your brand image is presented perfectly.

One, set the website logo in the Anqi CMS background

First, you need to upload the Logo image to the Anqi CMS system and specify it as the website's Logo. This process is very simple:

  1. Log in to the backend:Log in to your AnQi CMS backend management interface.
  2. Enter global settings:In the left navigation bar, find and click onBackend settingsSelect thenGlobal feature settings.
  3. Upload or select Logo:In the global feature settings page, you will see a named "Website LOGOThe configuration item. Click the upload or select button next to it, upload a Logo image file from your computer, or select an image already uploaded to the media library.Suggest choosing a logo image with moderate size and high clarity.
  4. Save settings:After confirming that the image selection is correct, click the "Save" button to apply the settings to the system.

After completing these steps, your website logo has been successfully uploaded and configured to the Anqi CMS backend.

Second, call and display the logo in the website template.

The logo image has been configured, and the next step is how to display it in the website's front-end template.The Anqi CMS template syntax is concise and clear, similar to the Django template engine, which can be easily implemented through specific tags.

To call the website logo, we need to use the Anqicms providedsystemtag. This tag is specifically used to obtain the various system configuration information of the website.

  1. Basic calling method:The most direct way is to<img>label'ssrccall directly in theSiteLogothis system variable.SiteLogoIt is preset to store the URL address of the website logo that you set in the background.

    <img src="{% system with name="SiteLogo" %}" alt="网站Logo" />
    

    This code will directly output the URL of the Logo image and use it as<img>label'ssrcthe attribute value. At the same time, to better comply with SEO standards and improve accessibility, it is recommended to add an imagealtProperty. Here we temporarily used 'Website Logo' as a placeholder.

  2. Optimize with the website namealtattribute:In order toaltMake the property more descriptive, we can usesystemTag to get the website name and use it as the logo imagealttext. The website name is insystemthe parameter corresponding to the tag isSiteName.

    <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
    

    Now, when the browser fails to load the logo image, or for users who use screen readers, they will see the name of the website, which greatly improves the website user experience and SEO performance.

  3. Use variables to make code more organized:If you need to call the Logo at multiple locations in the template or want the code structure to be clearer, you can first assign the Logo URL and website name to custom variables and then use these variables. Anqi CMS'ssystemThe tag allows you to directly assign the value obtained when calling a variable.

    {% system siteLogoUrl with name="SiteLogo" %}
    {% system websiteName with name="SiteName" %}
    
    <img src="{{ siteLogoUrl }}" alt="{{ websiteName }}" />
    

    here,siteLogoUrlThe variable now stores the URL of the Logo image,websiteNameThe variable stores the name of the website. You can use it directly in subsequent code.{{ siteLogoUrl }}and{{ websiteName }}to refer to them.

3. Further Thinking and Practice

In practical applications, in addition to simply displaying the Logo, we usually combine other features and practices to enhance the user experience.

  1. Make the Logo clickable and jump to the homepage:The website logo usually carries the function of returning to the homepage by clicking. By combiningsystemTagging for obtainingBaseUrl(the homepage address of the website), this interaction can be easily achieved.

    {% system siteLogoUrl with name="SiteLogo" %}
    {% system websiteName with name="SiteName" %}
    {% system baseUrl with name="BaseUrl" %}
    
    <a href="{{ baseUrl }}">
        <img src="{{ siteLogoUrl }}" alt="{{ websiteName }}" />
    </a>
    

    This way, when visitors click on the logo, they can smoothly return to the homepage of the website.

  2. Handle the case where the logo has not been uploaded:Sometimes, during the early stages of website construction or in certain situations, the Logo may not have been uploaded yet. IfSiteLogothe variable is empty,<img>label'ssrcThe property will be empty, which may cause the page to display abnormally. You can use conditional judgment to handle this situation:

    {% system siteLogoUrl with name="SiteLogo" %}
    {% system websiteName with name="SiteName" %}
    {% system baseUrl with name="BaseUrl" %}
    
    <a href="{{ baseUrl }}">
        {% if siteLogoUrl %}
            <img src="{{ siteLogoUrl }}" alt="{{ websiteName }}" />
        {% else %}
            <span class="site-title">{{ websiteName }}</span> {# 如果没有Logo,则显示网站名称作为文本Logo #}
        {% endif %}
    </a>
    

    This code will checksiteLogoUrlDoes it exist. If it exists, display the logo image;Otherwise, display the website name as a text logo (you can style it with CSS), to avoid display issues due to the missing logo.

  3. Suggestion for Logo optimization:To ensure website loading speed and user experience, make sure your logo image is properly optimized. This includes:

    • File Format:Use WebP format first (supported for automatic conversion in Anqi CMS content settings), followed by PNG or SVG.
    • File size:Compress the file size as much as possible, avoid using too large a Logo image.
    • Responsive design:Ensure that the logo image is clear and adapts to different sizes of devices (mobile, tablet, desktop).

By following these detailed steps and practical tips, you can fully master the website Logo settings and display in Anqi CMS, making your brand image shine on the website.


Frequently Asked Questions (FAQ)

Q1: Why is the Logo not displayed on the website frontend after I uploaded it?A1: There are several possible reasons. First, please confirm that you have saved the Logo settings in the background "Global Function Settings".Secondly, check whether your template file has used it correctly{% system with name="SiteLogo" %}This tag is used to call the Logo. Additionally, browser caching may cause display delay, you can try clearing the browser cache or accessing in incognito mode.

Q2: How can I display a different Logo on a specific page of the website instead of the global Logo?A2: The website logo of AnQi CMS is a global setting.If you need to display different logos on specific pages, you may need some custom template logic.A method is not to use in the template of this pagesystemThe tag calls the global Logo, but instead directly introduces a link to a specific Logo image.<img>Label. A more advanced approach is to set a Logo field for a specific page in the background custom parameters, and then judge and call this custom Logo in the template of that page. If the custom Logo does not exist, fall back to the global Logo.

Related articles

How to customize the footer information of the AnQiCMS website, such as copyright statement and filing number?

## Custom AnQiCMS website footer information: Copyright statement and record number setting guide The website footer, although at the bottom of the page, is an indispensable area for conveying important information, establishing brand trust, and meeting legal requirements.A clear and complete footer can enhance the professionalism of the website and provide visitors with convenient legal information and contact details.This article will introduce in detail how to customize the copyright statement, filing number, and other information you want to display in the footer of the website in AnQiCMS.

2025-11-07

How to implement the display of multi-level navigation menus in AnQiCMS and support secondary dropdown menus?

A clear and intuitive navigation system is the key to the success of any website, it can guide visitors to quickly find the information they need and greatly enhance the user experience.AnQiCMS as an efficient content management system, provides flexible and powerful functions to build and manage the navigation menu of the website, including perfect support for multi-level structures and secondary dropdown menus. ### Define your navigation structure in AnQiCMS backend The first step in building a multi-level navigation menu in AnQiCMS is to configure it in the backend management interface.You can go to the **"Back-end Settings"** area

2025-11-07

How to get and display the detailed content of the current article in AnQiCMS template?

Build a content-rich website, the article detail page is undoubtedly the core.It carries the most specific and valuable information on the website, and it is also one of the pages where users spend the longest time and interact most frequently.In AnQiCMS (AnQi CMS), with its flexible template engine and rich tag system, we can easily obtain and elegantly display the detailed content of the current article.

2025-11-07

What ways does AnQiCMS support for sorting the article list display, such as by views or publication time?

The display order of the website content list is one of the key factors affecting user experience and content operation effects.An excellent CMS system should provide a flexible sorting mechanism, allowing operators to freely adjust the display of articles according to content characteristics and promotion strategies.AnQi CMS deeply understands this, providing users with various ways to sort article lists, helping you accurately control content exposure and traffic guidance.### Core Sorting Feature: The Powerful Application of `archiveList` Tag In AnQi CMS

2025-11-07

How to display the links and titles of the previous and next articles on the article detail page?

In AnQi CMS, adding navigation links for the previous and next articles on the article detail page is a key step to enhance the user reading experience and optimize the internal link structure of the website.This not only encourages visitors to browse more content, but also helps search engines better understand the structure of the website.AnQi CMS provides a very intuitive and easy-to-use template tag, allowing us to easily implement this feature.Understanding the "Previous" and "Next" navigation mechanism The template system of Anqi CMS is designed to be very flexible.

2025-11-07

How to configure and display the recommended attributes of articles in AnQiCMS (such as头条, recommendation, slide)?

In AnQiCMS, let your important articles stand out on the website, such as setting them as the headline of the homepage, special recommendation, or slide show, which is a very practical content operation strategy.AnQiCMS offers intuitive features to help you easily manage the recommended attributes of these articles and flexibly display them on the website front-end. ### Backend Configuration of Article Recommendations Configuring article recommendations in the AnQiCMS management backend is a simple and direct process.

2025-11-07

How to display the subcategory list under a specified category in AnQiCMS template?

When using AnQiCMS to build a website, clearly organizing content and conveniently displaying it on the page is the key to improving user experience.Especially for content with multi-level classification structures, how to flexibly display the subcategory list under a specified category in the template is a need many users will encounter.A powerful template tag system of AnQiCMS, especially the `categoryList` tag, provides us with an elegant and efficient solution.### Understanding AnQiCMS Classification Structure Before delving into templates, it is important to understand how AnQiCMS manages classifications

2025-11-07

How does AnQiCMS handle and display image resources, including thumbnails and original images?

The charm of website content largely comes from images.They not only beautify the page, but also convey information directly, catching the reader's eye.Therefore, how a content management system (CMS) efficiently and intelligently handles and displays image resources is crucial for the overall performance of a website.AnQiCMS (AnQiCMS) provides a comprehensive and flexible solution in this regard, whether it is for the automatic generation of thumbnails or the optimization and presentation of the original images, it can help us easily manage the visual content of the website.

2025-11-07