How to apply different `show` parameters in the AnQiCMS template for different pagination types (articles, products, tags)?

Calendar 👁️ 72

In AnQiCMS (AnQiCMS) template development, implementing different display parameters for pagination of different content types (such as articles, products, tags) is an important link to improve user experience and website professionalism. As a senior website operations expert, I know that refined content display can effectively guide users, so today we will delve into how to skillfully use it in AnQiCMS.paginationlabel'sshowParameters, achieve this goal.

Fine-grained control of pagination display: How AnQiCMS customizes for different content typesshowParameter

In website operation, we often find that users browsing the "article" list tend to prefer more page navigation for quick jumps;When browsing the "product" list, due to the large space occupied by product images, the number of page navigation may need to be reduced to avoid visual clutter;For the "label" aggregation page, the page number settings may be different.AnQiCMS is a flexible and highly customizable content management system that fully considers these operational requirements, allowing us to easily implement these refined controls through its powerful template tag system.

The core lies in the template tags of AnQiCMSpagination. This tag is specifically used to generate pagination navigation, and one of its most important parameters isshow.showThe parameter allows us to specify the maximum number of middle page number links to be displayed in the pagination navigation. For example,show="5"Means the pagination bar will display the current page and up to 5 page number links (if the total number of pages is sufficient). Understanding this, we can set it separately in different types of content list templates.showParameters, to implement personalized pagination display.

Overview of AnQiCMS pagination mechanism.

Before delving into customization, we first need to understand the pagination principle of AnQiCMS. Whether it is an article list, product list, or tag-related content list, AnQiCMS usually first uses specific list tags such asarchiveListUsed for articles and products,tagDataListUsed for tag-related content) to query and retrieve data. When using these list tags, if we willtypethe parameter to"page", then these tags will also generate a pagination information list when returning the content listpagesobject. Subsequently, ourpaginationtags will receive and parse thispagesAn object, thus rendering a complete pagination navigation.

This means,paginationThe tag itself is generic; it does not care whether it is generating pagination for articles, products, or tags, it only responsible for the input.pagesObjects and their own configurationsshowParameters to render the page. Therefore, different parameters need to be applied for different content typesshowParameters, we just need to find and configure them in the corresponding template filespaginationTag it and it is.

Customize pagination display for the article list

Imagine that your website has a large number of technical articles, and users may need to frequently switch between different pages to find the information they need.At this time, we may hope that the pagination navigation of the article list page can display more page numbers.

Assuming your article list template file is locatedtemplate/default/archive/list.htmlortemplate/default/article/list.html(The specific path depends on your template structure and model settings), you can configure it like this:

{# template/default/archive/list.html (或对应的文章模型列表模板) #}

{# 使用 archiveList 标签获取文章列表数据,并启用分页模式 #}
{% archiveList articles with type="page" moduleId="1" limit="10" %}
    {# 这里是遍历 articles 变量,显示每篇文章的标题、简介等内容的代码 #}
    {% for item in articles %}
        <div class="article-item">
            <h3><a href="{{ item.Link }}">{{ item.Title }}</a></h3>
            <p>{{ item.Description }}</p>
            <span>发布日期: {{ stampToDate(item.CreatedTime, "2006-01-02") }}</span>
        </div>
    {% empty %}
        <p>暂时没有更多文章。</p>
    {% endfor %}
{% endarchiveList %}

{# 在这里配置文章列表的分页导航,我们希望显示7个页码链接 #}
<div class="pagination-area">
    {% pagination pages with show="7" %}
        {# 这里是分页链接的详细结构,例如首页、上一页、中间页码、下一页、末页等 #}
        <a class="first-page {% if pages.FirstPage.IsCurrent %}active{% endif %}" href="{{ pages.FirstPage.Link }}">首页</a>
        {% if pages.PrevPage %}<a class="prev-page" href="{{ pages.PrevPage.Link }}">上一页</a>{% endif %}
        {% for item in pages.Pages %}
            <a class="page-number {% if item.IsCurrent %}active{% endif %}" href="{{ item.Link }}">{{ item.Name }}</a>
        {% endfor %}
        {% if pages.NextPage %}<a class="next-page" href="{{ pages.NextPage.Link }}">下一页</a>{% endif %}
        <a class="last-page {% if pages.LastPage.IsCurrent %}active{% endif %}" href="{{ pages.LastPage.Link }}">末页</a>
    {% endpagination %}
</div>

By usingshow="7"Set in the pagination tag of the article list template, your readers will be able to see a wider page navigation when browsing articles, making it convenient to quickly browse a large amount of content.

Customize pagination display for product list

Compared to articles, product list pages usually focus on images and brief information, and the layout may be quite compact.In order to keep the page neat and focus on the product itself, we may want to have fewer page numbers in the pagination navigation.

Assuming your product list template file is locatedtemplate/default/product/list.htmlortemplate/default/archive/list.html(WhenmoduleIdWhen corresponding to the product model), you can configure it in the following way:

{# template/default/product/list.html (或对应的产品模型列表模板) #}

{# 使用 archiveList 标签获取产品列表数据,并启用分页模式 #}
{% archiveList products with type="page" moduleId="2" limit="8" %}
    {# 这里是遍历 products 变量,显示每个产品的图片、名称、价格等内容的代码 #}
    {% for item in products %}
        <div class="product-item">
            <img src="{{ item.Thumb }}" alt="{{ item.Title }}">
            <h4><a href="{{ item.Link }}">{{ item.Title }}</a></h4>
            <p>价格: {{ item.Price }}</p>
        </div>
    {% empty %}
        <p>暂时没有更多产品。</p>
    {% endfor %}
{% endarchiveList %}

{# 在这里配置产品列表的分页导航,我们希望只显示3个页码链接,更简洁 #}
<div class="pagination-area">
    {% pagination pages with show="3" %}
        {# 这里同样是分页链接的详细结构 #}
        <a class="first-page {% if pages.FirstPage.IsCurrent %}active{% endif %}" href="{{ pages.FirstPage.Link }}">首页</a>
        {% if pages.PrevPage %}<a class="prev-page" href="{{ pages.PrevPage.Link }}">上一页</a>{% endif %}
        {% for item in pages.Pages %}
            <a class="page-number {% if item.IsCurrent %}active{% endif %}" href="{{ item.Link }}">{{ item.Name }}</a>
        {% endfor %}
        {% if pages.NextPage %}<a class="next-page" href="{{ pages.NextPage.Link }}">下一页</a>{% endif %}
        <a class="last-page {% if pages.LastPage.IsCurrent %}active{% endif %}" href="{{ pages.LastPage.Link }}">末页</a>
    {% endpagination %}
</div>

In this case, we willshowthe parameter to"3"Making the pagination navigation on the product list page more compact, with the product's

Related articles

How can the `pagination` tag call data for a specific site using the `siteId` parameter in a multi-site management environment?

## Unlock AnQiCMS Multi-site Data: Deep Analysis of `pagination` Tag and `siteId` Parameter As an experienced website operations expert, I know that in a multi-site management environment, how to accurately and efficiently call and display data is one of the keys to operational success.AnQiCMS with its flexible multi-site management capabilities provides us with a strong foundation for content operations.Today, let's delve deeply into a problem that often arises in multi-site scenarios: how the `pagination` tag uses the `siteId` parameter

2025-11-07

Does AnQiCMS pagination tag support AJAX content loading to reduce overall page refresh?

As an experienced website operations expert, I fully understand how important page loading speed and interactive smoothness are in the pursuit of excellent user experience today.Especially in the scenario of handling pagination of a large amount of content, the traditional full-page refresh method often interrupts the continuity of the user's reading, even affecting retention.Therefore, does the AnQiCMS pagination tag support AJAX content loading to reduce the overall page refresh?This question naturally becomes a focus for many operators and developers.

2025-11-07

`archiveList type="page"` combined with `pagination`, how will pagination adapt when the `limit` value changes?

As an experienced website operations expert, I know that it is crucial to be able to display content flexibly and efficiently in a content management system.AnQiCMS (AnQiCMS) offers great convenience for content operation with its excellent flexibility and powerful template tag system.

2025-11-07

How to add a unique `data-id` attribute to each page number button in AnQiCMS pagination?

As an old soldier in the field of website operations for many years, I know that every detail can affect the performance of the website, user experience, and even the depth of data analysis.AnQiCMS is a modern content management system developed based on the Go language, providing strong support for our operational work with its high efficiency, flexibility, and ease of expansion.It has a unique Django template engine syntax that allows even relatively complex customization requirements to be implemented elegantly through concise code.Today, let's discuss a very practical little trick in daily operation and data analysis

2025-11-07

How to ensure that the `prefix` parameter set to `"?page={page}"` does not conflict with the pseudo-static URL rules?

As an experienced website operations expert, I am well aware of the importance of an efficient and SEO-friendly content management system for the success of a website.AnQiCMS (AnQiCMS) leverages its powerful pseudo-static function and flexible URL customization capabilities, providing great convenience for content operators.However, when using these powerful features, we sometimes encounter some seemingly simple but actually require deep understanding problems, such as setting the pagination parameter `prefix` to `"?"How to avoid conflicts with existing pseudo-static URL rules when "page={page}"` today

2025-11-07

Security CMS pagination navigation: easily achieve 'Total X pages' and 'Current page Y' intelligent display

As an experienced website operations expert, I know the importance of a smooth, complete pagination navigation for user experience and search engine optimization (SEO).AnQiCMS (AnQiCMS) provides us with powerful content management capabilities with its high-performance architecture based on the Go language, flexible template engine, and SEO-friendly design concept.Today, let's delve into how to巧妙地 display key information such as "Total X pages" and "Current page Y" in the pagination navigation of AnQiCMS, making the content of the website more professional and intelligent.

2025-11-07

Does AnQiCMS's pagination tag provide hooks or events for frontend JavaScript interaction?

## AnQiCMS Page Tag Interaction with Front-end JavaScript in Depth Analysis As an experienced website operation expert, I am well aware that the smoothness of front-end interaction is crucial for user experience in modern web design.Especially for common UI elements like pagination, users often expect a seamless loading experience rather than page refresh with each click.AnQiCMS (AnQiCMS) is an efficient content management system based on the Go language, with unique features in its template mechanism and tag usage. Today

2025-11-07

How to implement pagination navigation in AnQiCMS only when the page number exceeds X?

The Anqi CMS is an efficient and customizable enterprise-level content management system that provides great flexibility in content display.For website operators, how to intelligently manage and present page content, ensuring that users get **experience** while also considering SEO friendliness, is a fine issue that needs to be considered in daily work.Today, let's delve into a common requirement: how to implement pagination navigation in AnQiCMS only when the page number exceeds a certain threshold (X)?### Understanding AnQiCMS pagination mechanism In AnQiCMS

2025-11-07