What is the role of the `show` parameter of the `pagination` tag? How to control the number of page numbers displayed at the bottom of the page?

Calendar 👁️ 74

As an experienced website operations expert, I know that it is crucial to effectively guide users to browse and discover information when managing a large amount of content.Page functionality is the bridge that connects users with the deep content of a website.In AnQiCMS (AnQiCMS) such an efficient and customizable content management system, flexible use of pagination tags can greatly enhance user experience and the professionalism of the website.

Today, let's delve into AnQiCMSpaginationA core parameter of the tag -showLook at its function and how we cleverly use it to control the number of page numbers displayed at the bottom of the page.

Pagination: the cornerstone of content management websites.

Imagine a website with hundreds or even thousands of articles, products, or news, if all the content were piled onto one page, the user experience would be unimaginable.Pagination, it is born to solve this pain point. It divides a large amount of content into several small pieces logically, each corresponding to a page, and links these pages together through page numbers.This allows users to browse in an orderly manner and also helps search engines better understand the website structure.

In AnQiCMS, when we usearchiveListortagDataListtags such astype="page"pattern to obtain the pagination list data, it is usually followed bypaginationTags to render beautiful and practical pagination navigation. For example, when we need to display a list of articles, we might use it like this:

{% archiveList archives with type="page" limit="10" %}
    {# 循环显示文章列表内容 #}
{% endarchiveList %}

<div class="pagination">
    {# 这里就是分页标签发挥作用的地方 #}
</div>

paginationThe tag receives a name calledpagesThe variable contains all the information required for pagination, such as the total number of items (TotalItems)、total number of pages(TotalPages)、current page(CurrentPage) etc., as well as links to the home page, last page, previous page, next page, and middle page numbers.

showParameter: the key to elegantly control the display of page numbers

Now, let's focus onpaginationlabel'sshowParameter. Its function is intuitive and powerful:It allows us to specify the maximum number of middle page number links to display in the pagination navigation bar, excluding the first page, last page, previous page, and next page.

Why is this parameter so important? Imagine a list with hundreds of pages, if the pagination navigation bar displays all the page numbers (1, 2, 3, …, 98, 99, 100) all at once, it will be a long and difficult-to-navigate list, especially on mobile devices, it's a nightmare.showThe parameter is specifically designed to solve this problem, it can ensure that the user can see enough page numbers for jumping while maintaining the simplicity and aesthetics of the pagination component.

For example, when we setshow="5"At the moment, the pagination navigation bar will surround the current page number and intelligently display a total of 5 middle page number links. If the current page is the 3rd page, it may display 1, 2,34, 5; If the current page is the 10th page, with a total of 20 pages, it may display 8, 9,10And 11, 12. This way, no matter how many pages the website content has, the pagination navigation bar that the user sees is always compact and easy to click.

The following is an example of using a typical AnQiCMS templateshowExample of parameters:

<div class="pagination">
    {% pagination pages with show="5" %}
    <ul>
        {# 首页链接 #}
        <li class="page-item {% if pages.FirstPage.IsCurrent %}active{% endif %}">
            <a href="{{pages.FirstPage.Link}}">{{pages.FirstPage.Name}}</a>
        </li>

        {# 上一页链接 #}
        {% if pages.PrevPage %}
            <li class="page-item">
                <a href="{{pages.PrevPage.Link}}">{{pages.PrevPage.Name}}</a>
            </li>
        {% endif %}

        {# 中间页码区域,受 'show' 参数控制 #}
        {% for item in pages.Pages %}
            <li class="page-item {% if item.IsCurrent %}active{% endif %}">
                <a href="{{item.Link}}">{{item.Name}}</a>
            </li>
        {% endfor %}

        {# 下一页链接 #}
        {% if pages.NextPage %}
            <li class="page-item">
                <a href="{{pages.NextPage.Link}}">{{pages.NextPage.Name}}</a>
            </li>
        {% endif %}

        {# 末页链接 #}
        <li class="page-item {% if pages.LastPage.IsCurrent %}active{% endif %}">
            <a href="{{pages.LastPage.Link}}">{{pages.LastPage.Name}}</a>
        </li>
    </ul>
    {% endpagination %}
</div>

In this example,show="5"The instruction informs AnQiCMS about{% for item in pages.Pages %}This loop renders at most 5 page number links adjacent to the current page.Other pagination elements such as home page, end page, previous page, next page will be displayed independently to provide complete navigation capabilities.

how to control the number of pages according to actual needs?

The control of the number of pages displayed at the bottom of the page is very simple, just adjustshowthe value of the parameter:

  • show="3": If you want the pagination bar to be extremely concise, for example on mobile devices, you can only display one page on the left and one page on the right of the current page, plus the current page, totaling 3 pages.
  • show="7"If the page space allows, or if your website users are accustomed to direct page number jumps, you can increase the display quantity appropriately.
  • OmittedshowParameterIf there is no explicit statement in the document.showThe default parameter value, omitting it may cause AnQiCMS to display all available middle page numbers, which may not be an ideal choice when there are a large number of pages. Therefore, it is recommended to always explicitly set it.showthe value.

As website operators, we should decide on an appropriate one based on the overall design style of the website, the target user group, and the ratio of access devices (PC, mobile end)showValue. Usually, a page range of 3 to 7 middle pages is a balanced choice, as it can keep things concise and meet the user's fast navigation needs.

Summary

AnQiCMS'paginationLabel combinationshowParameters provide us with a powerful and flexible tool for achieving efficient pagination in content management systems.By cleverly controlling the number of displayed pages, we can not only optimize the user interface and improve the usability of the website, but also ensure that rich large websites always maintain a professional image.Remember, every detail can affect the user's stay and the conversion of the website.


Frequently Asked Questions (FAQ)

1. If the total number of pages on the website (TotalPages) is less thanshowThe number of parameters set, how will the pagination display?

If the total number of pages on the website, for example, is only 3 pages, and you willshowthe parameter to5,AnQiCMS will intelligently only display the actual existing page numbers, such as pages 1, 2, 3. It will not forcibly generate non-existing page numbers and will not report an error either.show="5"and will not generate non-existing page numbers forcefully, nor will it report an error.showThe parameter sets the maximum number of items to display.

2.showDoes the parameter only affect the visual display, or will it affect the search engine's crawling and indexing of the page?

showThe parameter is mainly a front-end display control parameter, which only affects the number of pagination links that the user sees in the browser.It will not change the total number of pages actually existing on the website, nor will it affect the search engine's crawling and indexing of all pagination content.The search engine will find and index all pages through pagination links (including the home page, last page, previous page, next page, and all intermediate pages' real URLs), regardless of how many page number links are displayed on the front end.Therefore, you have nothing to worry aboutshowParameters will affect the website's SEO effect.

3. Should I set different values on mobile and PC? Does AnQiCMS support this scenario?showIs that right? Does AnQiCMS support this kind of scenario?

Yes, this is a very good practice. Due to the limited screen size of mobile devices, it is usually recommended to set a smallershowfor example3or4), to avoid poor user experience due to too long pagination bars.AnQiCMS supports responsive template design (such as adaptive, code adaptation, PC+mobile independent site mode).You can customize in different templates (such as PC templates and mobile templates) forpaginationlabel with different settingsshowParameters, thus providing a ** pagination experience for different devices.

Related articles

How to correctly add basic pagination tag features to the article list in AnQiCMS?

In the digital age where content is king, the website's content list carries the primary entry point for users to explore information and understand products.A well-designed, smooth experience article list can not only effectively improve the user's stay time on the website, but also help users quickly find the information they need through accurate navigation guidance.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that understands this well, providing website operators with powerful and easy-to-use template tag functions, among which, adding basic pagination functions to the article list is a key factor in improving user experience and website accessibility.

2025-11-07

What core fields does each single page object returned by the `pageList` tag contain (such as ID, title, link)?

As an experienced website operations expert, I know that fully understanding the details of template tags in an efficient content management system like AnQiCMS is the key to fine-grained operations and content presentation.Today, let's delve into the `pageList` tag, an important tool for obtaining a single-page list, and explore the core fields and operational value contained in each single-page object (`item`).

2025-11-07

How to use the `for` loop to iterate over all single pages returned by the `pageList` tag in the AnQiCMS template?

In the world of AnQiCMS, flexibility and efficient management of content are its core advantages.Whether it is to publish corporate news, product details, or build a complex content matrix for multiple sites, AnQiCMS can provide strong and intuitive support.Today, as an expert operator who is well-versed in the field, I want to discuss with everyone a very practical skill in AnQiCMS template creation: how to skillfully use the `for` loop tag to traverse and display all the single page content returned by the `pageList` tag.

2025-11-07

The `pageList` tag defaults to fetching which single page data from the website?

As an experienced website operations expert, I am well aware of the efficiency and flexibility of AnQi CMS in content management.Today, let's delve deeply into an important member of the AnQiCMS template tag system - the `pageList` tag, especially regarding which single page data it will retrieve by default.Understanding this is crucial for us to present content efficiently and design templates. --- ## Deeply analyze the Anq CMS `pageList` tag: What single page data is retrieved by default?

2025-11-07

How to customize the text content of the 'First Page', 'Previous Page', 'Next Page', 'Last Page' pagination tags in AnQiCMS templates?

As an experienced website operations expert, I am well aware of the importance of website details in user experience and brand image.AnQiCMS (AnQiCMS) with its flexible template mechanism and strong multilingual support, allows us to easily meet these customization requirements.Today, let's delve into how to precisely customize the pagination labels such as 'Home', 'Previous', 'Next', and 'Last Page' in the AnQiCMS template, making your website's pagination not only functional but also full of brand characteristics.### Understand AnQiCMS

2025-11-07

How to determine the current page based on `pages.FirstPage.IsCurrent` or `item.IsCurrent` and add special CSS styles to it?

As an experienced website operations expert, I know how crucial clear navigation and page state indicators are in terms of user experience and search engine optimization (SEO).AnQiCMS (AnQiCMS) with its flexible and powerful template engine provides us with many conveniences, including the ability to accurately judge the current page status through boolean variables such as `pages.FirstPage.IsCurrent` or `item.IsCurrent` and add special CSS styles for it.This can not only significantly improve the user's browsing experience

2025-11-07

What do `pages.TotalItems` and `pages.TotalPages` represent in pagination tags, and what scenarios can they be used in?

As an experienced website operations expert, I know that a powerful and flexible content management system is crucial for the success of a website.AnQiCMS (AnQiCMS) boasts its efficient architecture based on the Go language and rich features, providing great convenience for content operators.Today, with the content of websites becoming increasingly rich, how to efficiently display and manage this content while providing an excellent user experience is a topic that every operator must face.The pagination mechanism is one of the core means to solve this problem.Today, we will deeply analyze the two key variables in the Anqi CMS pagination tag

2025-11-07

How to get and display the current page number in AnQiCMS template?

## The Art of Pagination Mastery: Easily Get the Current Page Number in AnQiCMS Templates As an experienced website operations expert, I am well aware of the importance of an efficient content management system for the vitality of a website.AnQiCMS with its high-performance architecture based on the Go language and flexible template mechanism has become the preferred choice for many small and medium-sized enterprises and content operation teams.In daily operations, we often need to display pagination information on list pages, search result pages, and other scenarios, where obtaining and displaying the current page number is a fundamental and core requirement. Today

2025-11-07