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

Calendar 👁️ 63

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

Understand the pagination mechanism of AnQiCMS

The pagination feature in AnQiCMS is usually implemented throughpaginationThe tag is implemented in the template. This tag is responsible for handling complex page number calculations, link generation, and current page status judgment, and then generates a page information that includes all pagination details.pagesThe object is provided for use in the template.

We usually see pagination code like this at the bottom of list pages (such as article list pages, product list pages).

{# 假设我们有一个名为 archives 的文档列表,并且 type="page" 开启了分页 #}
{% archiveList archives with type="page" limit="10" %}
    {# ... 文档列表循环内容 ... #}
{% endarchiveList %}

<div class="pagination-container">
    {% 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 %}
        {# 中间页码 #}
        {% 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 code, you can see such as{{pages.FirstPage.Name}}/{{pages.PrevPage.Name}}These variables are responsible for outputting texts such as 'Home' and 'Previous Page'.This default text content is usually obtained from the system's language package by AnQiCMS to support multilingual switching.

Custom pagination text: Deep into the language package

The most recommended and flexible way to customize this text is to use the multi-language (locales) mechanism of AnQiCMS.Even if your website currently supports only one language, customizing it in this way can lay a good foundation for future multilingual expansion.

The following are the specific steps:

  1. Locate or create a template forlocalesTable of contentsThe template files of AnQiCMS are stored in/templateUnder the directory. Each set of your templates will have an independent directory, for example/template/default. Under this template directory, you need to create a name forlocalesThe folder. If your template already supports multilingual, this directory may already exist.

    `template/ └── your_theme_name/

    ├── config.json
    └── locales/`
    
  2. Create or modify the language fileInlocalesIn the directory, you need to create a corresponding folder based on the language of your website, for example, if your website is Simplified Chinese, createzh-cnthe folder; if it is English, createen-us.

    Inzh-cnIn the folder of the language code you choose, create a file nameddefault.ymlYAML file. This file will be used to store your custom text key-value pairs.

    `template/ └── your_theme_name/

    └── locales/
        └── zh-cn/
            └── default.yml`
    
  3. Indefault.ymldefined custom textOpen.default.ymlFile, and add the custom pagination text content you want. You can define new keys and values for "Home", "Previous Page", "Next Page", "Last Page". For example:

    YAML

    Example content of default.yml file

    pagination: first_page: “Go to Home Page” previous_page: “<< Previous Page” next_page: “Next Page >>” last_page: “Go to Last Page” # You can also customize the name of the middle page number, if the system does not support the default, you can write it directly in the template

Related articles

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?

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.The pagination feature is the bridge that connects users to the deep content of the 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 a core parameter of the `pagination` tag in AnQiCMS, namely `show`, and see what its role is

2025-11-07

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

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

How does the `archiveList` tag work with the `pagination` tag to implement pagination when using the `type="page"` mode?

In AnQiCMS content management system, efficiently displaying a large amount of content and ensuring a good user experience and search engine optimization is the key to successful operation.Among these, the pagination display of the content list undoubtedly plays a core role.

2025-11-07