How to retrieve and display the Logo, thumbnail, and slideshow group on a single page?

Calendar 👁️ 62

In Anqi CMS, a single page (such as "About Us", "Contact Us", etc.) can not only carry rich text information but also greatly enhance the attractiveness and professionalism of the page through visual elements.Retrieve and display the Logo, thumbnail, and slide group image of a single page, which is a key step to optimize the page display effect.AnQi CMS provides flexible template tags, allowing you to easily implement these features.

Understand the composition of visual elements on a single page

In Anqi CMS, each single page can have exclusive visual elements to meet different display needs. We usually use the following types:

  1. Single page logo (or main image)This is usually the core visual representation of the page, possibly a large image used to highlight the theme or brand of the page.In AnQi CMS, it is usually referred to as 'Single Page Thumbnail Image'.
  2. Single-page thumbnailThis is a simplified preview image of the page content, relatively small in size, often used as a preview image in list pages, sharing, or as an auxiliary visual element in the local page.
  3. Single-page slide group image: If you wish to display a set of carousel images on a single page, such as team photos, product series images, or environmental displays, you will need to use the slideshow feature.

How to set these images in the background management

Before starting the template call, make sure you have uploaded the corresponding images to the single page in the background:

  1. Log in to the Anqi CMS background, go toPage Resources>Page Management.
  2. Edit or create a single page.
  3. In the editing interface of the single page, you will see named"Thumbnail"and"Banner Image".
    • "Thumbnail"This is what we commonly call a single-page thumbnail. You can upload one or choose an existing image.
    • "Banner Image"It corresponds to the logo (main image) and the slide group image of a single page.You can upload multiple images, which will be used as a slide group, and the first image is usually used as the main Logo or Banner image for the page.

Make sure you have uploaded the required images as per your requirements, so that they can be correctly called on the front end.

BypageDetailLabel to get single page information

Anqi CMS passedpageDetailTemplate tags to retrieve detailed information about a specific single page, including its visual elements. This tag is very flexible and can retrieve data based on the ID or URL alias of a single page.

Generally, if you are visiting a single-page,pageDetailThe tag will default to fetching information from the current page, no additional ID is needed. However, if you need to call specific single page information from other pages, you will need to go throughidortokenThe parameter to specify by the URL alias.

The basic syntax of the tag is as follows:{% pageDetail 变量名 with name="字段名称" %}

Among them,nameThe parameter is used to specify the fields you want to retrieve, for example.Logo/ThumborImages.

Retrieve the logo (main image) of a single page.

The logo of a single page is usually its most important visual symbol, which is obtained throughLogothe field, representing the 'thumbnail full image' of the page content.

You can use the following code to get and display it:

{# 假设您正在访问ID为1的单页面,或者当前页面就是目标单页面 #}
<div>
    {# 获取当前单页面的Logo #}
    {% pageDetail pageLogo with name="Logo" %}
    <img src="{{ pageLogo }}" alt="{% pageDetail with name='Title' %}" />
</div>

{# 如果要获取指定ID的单页面Logo,例如ID为5的单页面 #}
<div>
    {% pageDetail page5Logo with name="Logo" id="5" %}
    <img src="{{ page5Logo }}" alt="{% pageDetail with name='Title' id='5' %}" />
</div>

This code first goes throughpageDetailThe tag assigns the logo image address of the single page topageLogoa variable, and then in a<img>tag, use this variable to display the image.altThe attribute called the title of the single page, which is very helpful for SEO and accessibility.

Get the thumbnail of the single page.

Thumbnail of a single page is usually used in list or preview scenarios. It passes throughThumbthe field.

The following is a code example of obtaining and displaying a thumbnail of a single page

{# 获取当前单页面的缩略图 #}
<div>
    {% pageDetail pageThumb with name="Thumb" %}
    {% if pageThumb %} {# 建议添加条件判断,如果缩略图不存在则不显示 #}
        <img src="{{ pageThumb }}" alt="{% pageDetail with name='Title' %}" />
    {% else %}
        <img src="/static/images/default-thumb.jpg" alt="默认图片" /> {# 如果没有缩略图,可以显示一个默认图片 #}
    {% endif %}
</div>

{# 获取指定ID的单页面缩略图,例如ID为5的单页面 #}
<div>
    {% pageDetail page5Thumb with name="Thumb" id="5" %}
    {% if page5Thumb %}
        <img src="{{ page5Thumb }}" alt="{% pageDetail with name='Title' id='5' %}" />
    {% endif %}
</div>

Here is an additionifConditional judgment to deal with the situation where some single-page may not have uploaded thumbnails, thereby avoiding invalid image links on the page.You can also set the 'default thumbnail' in the 'Content Settings' backend, so that when no thumbnail is uploaded, the system will automatically use the default image.

Obtaining a slide group image of a single page

The slide group image is obtained throughImagesthe field, it returns an array of image addresses. Since it is an array, you need to usefora loop to iterate through and display each image.

Here is an example of code to display a single-page slide group image:

{# 获取当前单页面的幻灯片组图 #}
<div class="swiper-container"> {# 假设您使用Swiper或其他轮播库 #}
    <ul class="swiper-wrapper">
        {% pageDetail pageImages with name="Images" %}
        {% for item in pageImages %}
            <li class="swiper-slide">
                <img src="{{ item }}" alt="{% pageDetail with name='Title' %}" />
            </li>
        {% endfor %}
    </ul>
</div>

{# 如果您只需要获取幻灯片组图中的第一张作为页面的主图,可以这样做: #}
{% pageDetail pageImages with name="Images" %}
{% if pageImages %}
    {% set firstImage = pageImages[0] %} {# 获取数组中的第一个元素 #}
    <img src="{{ firstImage }}" alt="{% pageDetail with name='Title' %}" />
{% endif %}

This code will traversepageImagesFor each image address in the array, generate one<li>and<img>Label. Combine with front-end JavaScript carousel libraries (such as Swiper.js, Owl Carousel, etc.), and you can achieve dynamic slide effects.The second example shows how to only get the first image of the group photo as a cover image.

By combining these template tags, you can use them flexibly in Anqi CMS to obtain and display the logo, thumbnail, and slide group on a single page, bringing more visual presentation and a better user experience to your website.


Frequently Asked Questions (FAQ)

1. Why did I upload a single-page image but it did not display on the frontend?First, please check if you have indeed uploaded an image for this single page in the background "Page Management". Second, confirm that your template file is using the correctpageDetailLabel and field names (for exampleLogo/ThumborImagesto call. Finally, clear the browser cache and the SafeCMS system cache to ensure that the latest data and templates are loaded.

2. What is the difference between the "Logo" and "Thumbnail" on a single page? How should I choose which to use?In AnQi CMS'spageDetailTagged,LogoIt usually refers to 'single-page thumbnail large image', representing the main, larger-sized image on the page, suitable for the main visual or Banner. AndThumbIs a 'single-page thumbnail', usually the system is based on the preset

Related articles

How to obtain and display the links and titles of the previous and next articles?

When we manage and publish content in Anqi CMS, in order to enhance the user experience and content discoverability of the website, it is usually necessary to provide the function of navigating to the 'previous article' and 'next article' on the article detail page.This not only encourages readers to continue browsing the content within the site, but also provides a good internal link structure for search engine optimization (SEO).The Anqi CMS provides a very concise and intuitive template tag, allowing us to easily meet this requirement.### Core Functionality: `prevArchive` and `nextArchive`

2025-11-08

How to integrate a category list in the navigation menu and display product documents under each category?

In AnQi CMS, integrating product categories into the navigation menu and displaying the product documents below is a crucial step to enhance website user experience and content organization efficiency.This can help visitors quickly find the information they need, and it also helps search engines better understand the structure of the website. To achieve this goal, we need to make some basic settings in the Anqi CMS backend and integrate the corresponding code in the template files according to these settings.

2025-11-08

How to implement nested category display with multiple levels and how to judge if there is a subcategory in the template?

When building a website, a clear and organized content structure is crucial for enhancing user experience and SEO performance.AnQiCMS (AnQiCMS) relies on its flexible content model and powerful template engine, allowing us to easily implement complex multi-level nested display and subcategory judgment, thus creating highly customized navigation and content layouts. ### Backend Settings: Build Category Hierarchy In the Anqi CMS backend, the category management feature (usually located under the "Content Management" menu, below "Document Category") is the foundation for implementing multi-level categorization. First

2025-11-08

How to retrieve and display details of a specific category, including description, content, and Banner image?

When operating a website, we often need to display unique content for different category pages, such as a product category may have a detailed introduction and an eye-catching Banner image, while a news category may focus more on a concise description.AnQi CMS provides a flexible mechanism that allows us to easily retrieve and display detailed information about specific categories, including descriptions, content, and Banner images.### Backend settings are fundamental: enriching categories Before displaying category details on the frontend, we need to fill in this information in the Anqi CMS backend

2025-11-08

How to display copyright information and link to the record number at the bottom of the website?

Clearly display copyright information and filing number at the bottom of your website, which is not only a legal requirement but also a key factor in enhancing the professionalism and user trust of the website.AnQi CMS as an efficient content management system, fully considers these details, allowing you to easily manage and present these important site information. ### Understanding the Importance of Copyright Information and Filing Numbers The copyright statement at the bottom of the website, like a brand watermark, clearly identifies the ownership of the content to visitors, effectively protecting your original achievements.As for websites operating in mainland China

2025-11-08

How to dynamically control the display of content in the template based on conditional logic (if/else)

In AnQiCMS template design, it is possible to flexibly control the display of content based on different conditions, which is the key to achieving website personalization and dynamic display.Whether it is to decide whether to display the picture according to whether the article has a thumbnail, or to display specific content based on the user's role, conditional logic can provide strong support.AnQiCMS uses a syntax similar to the Django template engine, which makes it very easy for webmasters familiar with web development to get started quickly.### Master the basic conditional logic in AnQiCMS templates AnQiCMS

2025-11-08

How to use for loop to traverse list data in the template and display it?

In website content management, dynamically displaying list data is a very basic and important function.Whether it is a news list, product display, category navigation, or friend links, we need to be able to flexibly obtain data from the backend and present it on the frontend template.AnQiCMS (AnQiCMS) provides a powerful and easy-to-use template engine that allows us to easily meet these requirements, among which the 'for loop' is the core tool for displaying list data.AnQiCMS's template engine adopts a syntax style similar to Django

2025-11-08

How to process and display variable content through filters (such as `truncatechars`, `safe`)?

## Optimize Content Display: Application of Variable Filters in AnQi CMS How to present information accurately and beautifully in website content management is the key to improving user experience.AnQi CMS is a flexible and efficient content management system that provides a powerful template engine, allowing us to refine and display variable content through various filters, thereby better meeting the needs of page layout and information delivery.These filters are like the 'makeup artists' of content, allowing the original data to be displayed in the most appropriate form.The AnQi CMS template engine uses syntax similar to Django

2025-11-08