How to customize the content display layout of the Anqi CMS homepage?

Calendar 👁️ 67

Your website's homepage is the first impression for visitors, as well as the window to show brand image and core content.How can this 'front door' be both aesthetically pleasing and efficient in conveying information, which is a concern for every website operator.AnQiCMS (AnQiCMS) is a content management system that emphasizes customization and flexibility, providing us with a very convenient way to freely create a dedicated home page layout.

To customize the Anqie CMS homepage content display layout, we mainly focus on its powerful template system and content tags.The core concept of system design is to allow users to easily present the backend data dynamically on the front-end page, while supporting highly flexible layout adjustments.

Deep understanding of the template file structure

The homepage layout of AnQi CMS, the core lies in its flexible and powerful template system. The presentation of all website pages cannot do without the location of/templatetemplate files in the directory. Usually, we will find the template folder we are currently using here, for exampledefault.

in your template folder,index/index.html(or under a flat structure,index.htmlIt is the entry file of the homepage. It is the place where the overall structure and content display logic of the homepage are defined.

The template syntax of AnqiCMS is similar to the Django template engine, it is very easy to get started. Data variables are defined using double curly braces.{{变量}}Print, while logical tags such as conditional judgment and loop control use single curly braces and percent signs.{% 标签 %}and require corresponding end tags, such as{% if 条件 %}...{% endif %}.

We usually useextendsandincludethese auxiliary tags.extendsTags allow us to inherit a basic template (such asbase.htmlThus, it can reuse common page headers, footers, sidebars, etc., to avoid rewriting code.includeTags can embed some small, reusable code snippets (such as news list modules, product display blocks) into the main template, making the code more modular, easier to manage and maintain.

Utilize the powerful tags of Anqi CMS to obtain content

It is not enough to have just a static HTML skeleton; we need to dynamically display the content of the backend management on the homepage.AnQi CMS provides a series of powerful template tags, which are like data movers, helping us to retrieve various types of content from the background and display them according to our layout requirements.

First, the basic information of the websiteis indispensable. We can usesystemTag to get the global settings information of the website, such as:

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

Next, the navigation menuIs an important element to guide visitors to browse the website.navListThe label can conveniently retrieve the menu items configured in the "navigation settings" of the background, support multi-level navigation, and allow us to easily build the main navigation or footer navigation of the website:

{% navList navs %}
<ul>
    {% for item in navs %}
        <li><a href="{{ item.Link }}">{{item.Title}}</a></li>
    {% endfor %}
</ul>
{% endnavList %}

For the visual focus on the homepage, such as the carousel,bannerListLabels can be put to use. It will retrieve the homepage Banner list configured in the background, allowing us to display attractive slides on the homepage:

{% bannerList banners %}
    {% for item in banners %}
        <a href="{{item.Link}}"><img src="{{item.Logo}}" alt="{{item.Alt}}" /></a>
    {% endfor %}
{% endbannerList %}

If the homepage needs to display articles or products under a specific category,categoryListandarchiveListTags are our powerful assistants. For example, we want to display the latest articles under the "News and Information

{# 展示文章模型下ID为1的分类(如新闻资讯)的最新10篇文章 #}
{% archiveList archives with moduleId="1" categoryId="1" limit="10" order="id desc" %}
    {% for item in archives %}
        <h3><a href="{{item.Link}}">{{item.Title}}</a></h3>
        <p>{{item.Description|truncatechars:100}}</p>
    {% endfor %}
{% endarchiveList %}

{# 展示产品模型下ID为2的分类(如热门产品)的图片列表 #}
{% archiveList products with moduleId="2" categoryId="2" limit="8" flag="c" %}
    {% for item in products %}
        <div><img src="{{item.Thumb}}" alt="{{item.Title}}" /><p>{{item.Title}}</p></div>
    {% endfor %}
{% endarchiveList %}

BymoduleIdSpecify content model (article or product),categoryIdSpecify categorylimitLimit the number of displayed itemsorderControl sorting method,flagWe can accurately control the display of various content on the homepage by filtering recommended attributes.

For static content such as 'About Us' or 'Contact Information'.If they exist in a single-page form,pageDetailthe tags can be directly retrieved and displayed. While if this information is configured through the background "Contact Information Settings", thencontactTags can help us retrieve the corresponding fields.

{# 展示ID为1的单页面内容,例如“关于我们” #}
{% pageDetail pageDetail with id="1" %}
    <h2>{{pageDetail.Title}}</h2>
    <p>{{pageDetail.Description}}</p>
{% endpageDetail %}

{# 展示联系电话 #}
<p>联系电话:{% contact with name="Cellphone" %}</p>

Further customization: content model and custom fields.

The "Flexible Content Model" of AnQi CMS is a core strength, allowing us to customize content models and fields according to business needs. This means that if the built-in article, product fields cannot meet your display requirements, you can create new fields (such as adding custom parameters like "material", "size" for products), and then use them in templates byarchiveParamsTags or go through directlyarchiveDetail with name="自定义字段名"In order to obtain and display this additional data. This is crucial for building highly specialized product display pages or rich service introduction modules.

At the same time, combiningifLogical judgment andforLooping through tags, we can implement more complex layout logic.For example, determine whether a certain area has content, and display it if it does, or hide it if it does not; or display different styles based on the data type.filters(Filters) can also format content during output, for exampletruncatecharsused to truncate text,safeused to safely output HTML content, making the presentation of the page more refined.

Back-end management is the foundation for front-end customization

Although we focus on the code level, do not forget that all of these front-end custom displays are inseparable from the detailed configuration of the background. In the Anqi CMS background management interface, the following areas are closely related to the customization of the home page content:

  • Backend Settings -> Global Function SettingsHere you can set the website name, Logo, record number, mobile end address, etc., this information will be called throughsystemtags on the front end.
  • Background settings -> Navigation settings: Manage the navigation menu structure of the website, which directly affectsnavListThe output of tags.
  • Content management -> Document classification & Content model & Document managementThis is the source of all dynamic articles and product content. Custom models and fields, creating categories, publishing documents, and more will be completed here, and byarchiveList/categoryListthese tags are retrieved.
  • **Page Resources -> Page Management

Related articles

How to ensure that the website content of AnQi CMS adapts to display on different devices (PC, mobile)?

One of the most painful problems we face in running websites in this multi-screen era is how to make the content of the website display effectively on different devices.Users may browse using a PC, smartphone, or tablet. If the content does not adapt to display, the user experience will be greatly reduced.AnQiCMS (AnQiCMS) provides a very mature and flexible solution in this aspect, aiming to ensure that your website content looks pleasing on any device.### AnQiCMS' Various Content Adaptation Modes AnQiCMS understands that different websites have different needs

2025-11-08

How does AnQi CMS display the prompt information when the website is closed?

During the operation of the website, we often encounter situations where we need to maintain, upgrade the website, or temporarily close the website for some special reasons.How can you inform the visitor in a friendly manner about the current status of the website, to avoid them seeing a chaotic or error page, which is particularly important.AnQiCMS (AnQiCMS) fully considers this requirement, built-in convenient and flexible shutdown prompt function, allowing you to easily deal with such scenarios. ### Flexible website status configuration, easily enable shutdown mode The shutdown function of Anqi CMS is very intuitive to configure. You just need to log in to the website backend

2025-11-08

How to display custom site parameters on the front-end page?

When operating a website, we often encounter such needs: we need to display some flexible and variable site information on the front-end page, such as the company's establishment year, customer service hotline, promotional slogans for specific pages, or a brief announcement, etc.This information may need to be updated frequently, and it is inefficient and prone to errors to modify the template file each time.Fortunately, Anqi CMS has provided us with a very convenient way to manage and display customized site parameters on the back-end, making content operation more efficient and flexible.

2025-11-08

How to safely display HTML tags in a template without being parsed by the browser?

In website content management, we often encounter the need to display HTML code snippets, such as code examples in tutorials, and language annotations in technical articles.However, if the content containing HTML tags is directly output to the page, the browser will parse and render it, rather than displaying it as plain text.This could lead to layout errors on the page, more seriously, if unprocessed user input contains malicious scripts (such as `<script>alert('XSS')</script>`), it can trigger cross-site scripting (XSS) attacks

2025-11-08

How can I design a dedicated display template for the article list in AnQi CMS?

In AnQi CMS, designing a dedicated display template for the article list is a key step to creating a unique website style and optimizing the user experience.AnQi CMS provides us with a great degree of freedom with its flexible content model and powerful template engine (similar to Django syntax), allowing us to present diverse article lists based on different content types, marketing objectives, or user needs.The website's article list page is like a showcase of content, how to arrange and highlight the key points directly affects visitors' browsing interest and conversion effect.A well-designed list template

2025-11-08

What ways does AnQi CMS support to individually present the detailed content of a single document?

When using AnQi CMS to manage website content, if you want each document's detailed content to be presented in a unique and eye-catching way, the system provides very flexible customization settings.This is not just about changing the text color or font size, but also about deep customization from content structure to display form.Firstly, the foundation of personalized display lies in **content model and custom fields**.Our AnQi CMS allows us to create different content models based on actual business needs, such as 'articles', 'products', 'news', and even 'cases'.

2025-11-08

How can you implement a unique display style for content under a specific category in AnQi CMS?

In website operation, we often encounter such needs: a particular content category needs a unique display style to highlight the importance, uniqueness, or brand character of its content.For example, your 'news center' may require a concise list layout, while 'selected cases' may require a more visually striking grid layout or slideshow display.AnQiCMS provides powerful template customization capabilities, making it intuitive and efficient to achieve this goal.Why do you need to customize the display style for a specific category?A unified website style is indeed important

2025-11-08

How to utilize the multi-site feature of Anqi CMS to achieve unified or differentiated display of content between different sites?

The multi-site feature of AnQi CMS is an extremely powerful feature, which provides unprecedented flexibility for website operators, whether it is managing multiple independent brand websites or building a content-sharing matrix, they can handle it with ease.The core of this feature lies in the fact that it allows you to efficiently manage and display multiple independently operated websites under a single secure CMS system, and cleverly balances content differentiation and unity.### Understanding the multi-site capability of AnQi CMS Firstly, we need to clarify the operation mode of the multi-site function of AnQi CMS

2025-11-08