How to display the website's logo image on the front page?

Calendar 👁️ 76

The website logo is the core of the brand image, it not only enhances the professionalism of the website, but also deepens the users' understanding of the brand.In AnQiCMS, displaying your logo image on the front page is a straightforward and flexible process, mainly involving backend settings and template code adjustments.

Step 1: Upload and configure your Logo on the AnQiCMS backend

In AnQiCMS, managing the website's logo image is very convenient. First, you need to upload the logo image to the system's backend.

After entering the background management interface, find the "Background Settings" in the left navigation bar, and click to enter the "Global Settings" option.On the global settings page, you will see a configuration item named "Website Logo".Click the upload button next to this option, you can select a local Logo image to upload, or choose one from the uploaded image library as the website's Logo.Make sure the logo image you upload is clear and moderately sized to ensure the best display effect on the front page.After uploading and selecting an image, the system will automatically save your settings.

Step 2: Call and display the Logo image in the front-end template

Next, we need to add the corresponding code to the front-end template file of the website so that the logo image you upload can be displayed.

The website's logo is usually placed at the top (Header) or bottom (Footer) of the page in common areas, these parts are usually located in your template folder in the AnQiCMS template system, for example/template/您的模板名称/) underbash.htmlOr similar public template files. Open these files, and you can start adding the Logo display code.

AnQiCMS provides a very convenient template tag to call the information set in the background. For the website logo, we can use{% system %}The tag is used to retrieve various system information configured in the background "Global Settings".

The following is a basic code snippet for displaying the logo image.

{% system logoPath with name="SiteLogo" %}
{% system siteName with name="SiteName" %}
{% system baseUrl with name="BaseUrl" %}

{% if logoPath %}
    <a href="{{ baseUrl }}">
        <img src="{{ logoPath }}" alt="{{ siteName }}" />
    </a>
{% else %}
    <a href="{{ baseUrl }}">
        <h1>{{ siteName }}</h1>
    </a>
{% endif %}

Let's go into a detailed explanation of this code:

  • {% system logoPath with name="SiteLogo" %}This line of code assigns the path of the Logo image you uploaded in the background "Global Settings" to a variable namedlogoPath.
  • {% system siteName with name="SiteName" %}Similarly, this line of code assigns the website name you entered in the background "Global Settings" tositeNameVariable.
  • {% system baseUrl with name="BaseUrl" %}This line of code retrieves the root address of the website (usually your domain) and assigns it tobaseUrlVariable.
  • {% if logoPath %}This is a conditional judgment, it will checklogoPathDoes the variable have a value. If the logo has been uploaded to the background,logoPathit will include the image URL, the condition is met.
  • <a href="{{ baseUrl }}"> ... </a>In order to enhance the user experience, we usually wrap the Logo image in a<a>tag and move ithrefThe attribute is set to the website's homepage address. This way, when the user clicks on the Logo, they can quickly return to the homepage.{{ baseUrl }}It will dynamically display the address of your website.
  • <img src="{{ logoPath }}" alt="{{ siteName }}" />This is the core part of displaying the Logo image.
    • srcattribute:{{ logoPath }}It will dynamically display the Logo image URL you uploaded on the backend.
    • altattribute:altThe attribute provides text descriptions for images, which is very important for search engine optimization (SEO) and accessibility (such as screen reader use for visually impaired users).{{ siteName }}Dynamically displays the name of your website, as the description of the logo, this is recommended practice.
  • {% else %} ... {% endif %}If:logoPathThere is no value (i.e., you have not uploaded a Logo image on the backend), this code will act as a backup and display a wrapped in<h1>The website name in the tag, which is also linked to the homepage. This can prevent the appearance of a blank placeholder when the logo is missing, improving user experience.

Place this code in the location of your template where you want to display the Logo, for example<body>within the label<header>area. After saving the changes, refresh your website's frontend page, and you will see your Logo image.

optimize and **practice

  • CSS style adjustment: After the logo image is displayed, you may need to adjust its size, position, or margin through CSS to keep it consistent with your website design style. You can do this in the template's CSS file (usually in/public/static/您的模板名称/css/Add style rules, such as for the logo image location<img>tagsclassoridThen fine-tune the control through CSS.
  • Image optimization: AnQiCMS provides features such as automatic image compression and WebP format conversion in the 'Content Settings'. Enabling these features can help your logo image load faster.

Related articles

How to enable and configure the website comment form in AnQiCMS and display custom fields?

In AnQiCMS, creating an interactive guest留言表单 form that collects feedback and can be flexibly configured with custom fields is a very practical feature.AnQiCMS provides a simple and efficient way to achieve this goal, whether it is backend settings or frontend display, it can be easily mastered. ### Enable and configure the message function on the back-end Usually, when you want website visitors to contact you or collect their feedback, a message form is the preferred choice.

2025-11-07

How to format the display of the article's publish time in the template, for example “2023 June 1st”?

When operating a website, the time an article is published is often one of the important pieces of information that users are concerned about.A clear and readable time format not only enhances user experience but also helps to improve the professionalism of website content.AnQi CMS is an efficient and customizable content management system that provides a flexible way to control the display of various information in templates, including the publishing time of articles.

2025-11-07

How to display the user's submitted comment content and avatar in the website comment section??

Displaying user comments on the website is a key element in enhancing user interaction and content vitality.For websites using AnQiCMS, its powerful template tag system makes this operation intuitive and flexible.This article will thoroughly introduce how to clearly display user-submitted comments in the website's comment section, accompanied by their unique avatars, thereby enriching the website's user experience.--- ### Understanding the Basics of AnQi CMS Comment Function Firstly, we need to understand how comment content operates in AnQi CMS

2025-11-07

How to display the article summary instead of the full text on the search results page?

How to make users quickly understand the content of the article on the search results page without directly displaying the full text, which is not only related to user experience but also a key factor in search engine optimization (SEO).For those using AnQiCMS, achieving this is very flexible and efficient.

2025-11-07

How to use the `tdk` tag in the template to display the current page's canonical URL?

In website operation, we all hope that our content can be accurately understood and efficiently indexed by search engines.Among them, Canonical URL (standard link) is a very important concept.It can help us solve the problem of duplicate content that may arise due to similar content or accessible from multiple URLs, clearly telling search engines which is the main version of the content, thus concentrating the ranking weight of the page and avoiding dispersion.AnQi CMS as an efficient and flexible content management system, fully considers the needs of SEO optimization, and built-in powerful TDK (Title

2025-11-07

How to display website traffic statistics in the background in the form of charts?

In website operation, understanding and analyzing traffic data is a key link in formulating effective strategies and optimizing website performance.AnQiCMS (AnQiCMS) fully understands this, and therefore provides an intuitive and convenient traffic statistics function in the background, allowing operators to easily grasp all the data of the website in the form of charts, thereby better driving content and marketing decisions.The traffic statistics feature of Anqi CMS is designed to provide a comprehensive view of website performance.It not only records the user's visit behavior, but also pays special attention to the activities of search engine spiders, which is crucial for SEO work.Through the background data statistics module

2025-11-07

How to use the `archiveFilters` tag to implement multiple condition combination filtering on the front end?

AnQiCMS provides flexible and powerful content management capabilities, one very practical feature is to use the `archiveFilters` tag to implement multi-condition combination filtering on the front-end.This undoubtedly greatly enhances the user experience and the discoverability of content for websites that are rich in content and require users to search for information based on different dimensions, such as product displays, real estate rentals, recruitment information, and so on.Let's delve deeper into how to use the `archiveFilters` tag to build an intuitive and efficient filtering system for your website.

2025-11-07

How to use the `tagList` tag to display the associated tag (Tag) cloud of the article?

AnqiCMS provides a series of powerful and flexible tags to help us manage and display website content more efficiently.Among many features, the article tag (Tag) is a very practical feature that can effectively organize content, enhance the internal link structure of the website, and make it convenient for visitors to quickly find related topics of interest.Today, let's delve into how to use the `tagList` tag to elegantly display related tags in the AnqiCMS template, and even build a dynamic 'tag cloud'.

2025-11-07