In the daily operation and template design of AnQiCMS (AnQiCMS), we often encounter questions about the flexibility of content display. One of the very specific and frequently mentioned issues is: pages.Pagesin the array,NameCan fields other than numbers be customized to display other text?As an experienced website operation expert, I will combine the features and content operation strategies of AnQiCMS to deeply analyze this issue for everyone.
Translate AnQiCMS pagination page number:pages.Pagesin the array,NameCan the field be customized to display text?
When we discusspages.Pagesin the array,NameWhen dealing with a field, it is first necessary to clarify its context - this is usually in the AnQiCMS template, used to build pagination navigation,paginationthe data structure returned by the tag. Intag-pagination.mdThe document, we can seepaginationthe tags returned bypagesobject containsPagesThis middle page number array, and eachitem(i.e.),pageItem) all haveName/LinkandIsCurrentThree fields.
To put it directly, forpages.PagesThe array represents specific page numbers.NameField, AnQiCMSNo direct customization feature is provided to display non-numeric textThis means that you cannot directly modify the page numbers '1', '2', '3', etc. in the pagination navigation to 'first page', 'next page', or any other custom text.
From the design philosophy of AnQiCMS, such a setting has its reasonable considerations.AnQiCMS as an enterprise-level content management system, its functional design focuses on efficiency, maintainability, and the consistency of user experience.The page number in pagination navigation, which plays a core role in clearly indicating the current page position and the index of pages that can be navigated to.Using numbers as page number names is a globally universal, most intuitive, and lowest cognitive cost display method.
For example, intag-pagination.mdIn the example code, we can see that the middle page number part is rendered through{% for item in pages.Pages %}<a class="{% if item.IsCurrent %}active{% endif %}" href="{{item.Link}}">{{item.Name}}</a>{% endfor %}such a structure. Here is the{{item.Name}}The numbers corresponding to the pages (such as 1, 2, 3, etc.) will be directly output, which is automatically generated based on the internal pagination logic of the system. There is no interface for external customization to modify its text.
However, this does not mean that all the text of pagination navigation cannot be customized.paginationthe tags returned byFirstPage(Home page),LastPage(End page),PrevPage(Previous page) andNextPage(Next page) and other special pagination links, theirNameFields are displayed by default with descriptive text such as 'Home', 'End Page', etc. These texts are usually available through the AnQiCMS built-in multilingual package (such asAnQiCMS 项目优势.mdMentioned "multilingual support" andhelp-setting-system.mdTo switch to the "default language package" to adapt to the website needs under different language environments. For example, bytag-tr.mdThe translation label introduced, which can be implemented in the template to translate these fixed descriptive texts, but not for custom modification of page numbers.
It is noteworthy that AnQiCMS exhibits high flexibility in customizing other "Name" or "Title" fields. For example:
- Single page management(
help-source-page.md): You can set custom 'page name' (Title) and 'custom URL' (filename) for single pages such as 'About Us', 'Contact Us', etc. in the background to meet personalized content display and SEO requirements. - Document Category(
help-content-category.md): The category name can be freely set, and a custom URL can be set for the category. - Content model(
help-content-module.md):Custom models allow you to define various field "parameter names", which are highly controllable display text.
Therefore, when we mention in AnQiCMS whether the "Name" field can be customized, we need to distinguish which kind of "Name" is meant: if it refers to the number representing the page number in the pagination navigationNameThe field, then the answer is that it does not support direct customization to other display text;If it refers to other page content, categories, tags, or URL aliases, AnQiCMS provides rich customization options.This design ensures the stability and consistency of core functions (such as pagination) while also considering the flexibility of content management on other levels.
Frequently Asked Questions (FAQ)
Ask: In AnQiCMS, besides the pagination page numbers, where else can the "Name" or "Title" be customized to display text? Answer:AnQiCMS provides a high degree of text customization on many content levels.For example, in "Page Management", you can set the "Page Name" for each single page;In the 'Document Category', you can customize the 'Category Name';In the "document tag", you can set the "tag name";Even in the 'Content Model', you can also specify the 'parameter name' for custom fields.These fields can be flexibly set to any display text according to your operational needs.
Ask: Does AnQiCMS support displaying the text of 'Home', 'Previous Page', 'Next Page', and other pagination navigation in other languages? Answer:Yes, AnQiCMS supports multilingual functionality. These descriptive pagination navigation texts, such as "Home", "Previous page", etc., are usually integrated into the system's built-in language packages.You can set the language package in the AnQiCMS background or use translation tags in the template (such as
{% tr "yourLocation" %}To implement automatic switching of fixed text in different language environments. This is different from directly customizing page number digits, as it is more based on system-level multilingual localization.Ask: Can I customize the URL structure of pagination links to include aliases or paths other than numbers? Answer:AnQiCMS allows you to use the "pseudo-static rules" (
help-plugin-rewrite.mdTo highly customize the website's URL structure. In custom mode, you can define the inclusion of document lists, model home pages, etc.{page}(Page number),{filename}(Custom link name),{module}The rule for variables such as (model table name). This means you can design SEO-friendly pagination URLs, such as/{module}-{filename}-{page}.htmlHowever, here is{page}It will still be parsed as a number, you cannot replace it with custom display text. This is customization for the URL structure, not the pagination page number display text.