What is the correct way to use the pagination page number variable `{page}` when customizing the AnQi CMS static rules?
As a senior security CMS website operator, I am fully aware that a clear and efficient static rules are crucial for the SEO performance and user experience of a website.AnQi CMS provides powerful pseudo-static functions, allowing us to highly customize URL structures according to actual needs.Today, let's delve deeply into the page number variable in customizing the static rules of the AnQi CMS{page}The correct way to use it.
Anqi CMS static rules and their importance
The technique of rewriting dynamic URLs to more readable and search engine friendly static URLs is called pseudo static.In Anqi CMS, the pseudo-static feature can help us build URLs that are logical, easy to remember and share, which is not only beneficial for search engine crawling and ranking, but also enhances users' trust and ease of use on the website.AnQi CMS provides a variety of built-in static page modes for selection, and also opens up the configuration of custom static page rules to meet more personalized needs.
In custom rules, we will use a series of predefined variables such as{id}(Data ID)、{filename}(Custom data link name)、{catname}(Custom category link name)、{catid}(Category ID),{module}The model table name, etc. While for the pagination processing of the list page, Anqi CMS introduces a special variable:{page}.
Understand the pagination page number variable{page}the function
In website operation, content lists are usually divided into multiple pages to avoid the content of a single page being too long, affecting loading speed and reading experience.When the user clicks 'Next page' or jumps to a specific page number, the URL should clearly reflect the current pagination state.{page}The variable is born for this, it represents the page number of the list page.
Integrate correctly in the pseudo-static rules{page}Variables can ensure that each page has a unique and semantically meaningful URL. For example, the second page of an article list, its URL might be from/article/list.htmlchanges to/article/list-2.htmlOr/article/list/page-2This depends on the rules we define. A clear URL structure is crucial for search engines to understand the depth and navigation structure of a website, and it also helps users determine their location through the URL.
Use correctly{page}Syntax and practice of variables
A safe CMS custom pseudo-static rule is about{page}the use of variables has specific syntax requirements. The core is,{page}variables must be enclosed in a pair of parentheses, for example(-{page}). This design is for flexibility, making the page number part optional. This means that when on the list of **pages, the page number information can be omitted from the URL (for example/article/list.html), and the page number information will be explicitly displayed in the URL from the second page (for example/article/list-2.html)
The following are some common scenarios where usage{page}is an example of the pseudo-static rule of variables:
Page pagination on category list page: When we need to set up a pseudo-static rule for a list page of a certain content category and support pagination, we can use a configuration similar to the following:
category===/{module}/{catname}(-{page}).htmlIn this example,{catname}represents the custom link name of the category. When browsing **page, the URL may be/article/news.html; When browsing the second page, the URL changes to/article/news-2.html.Pagination of the tag list page: For a list page filtered by a specific tag, the pagination rule can be defined as follows:
tag===/tag/{tagname}(-{page}).htmlOr, if the rule is based on Tag ID:tag===/tag-{id}(-{page})Here, the URL of **page may be/tag/seo.htmlor/tag-1.htmland the second page will be/tag/seo-2.htmlor/tag-1-2.html.pagination on the home page or other model list page: Although the document mainly targets
categoryandtagexamples were given, but{page}Variables also apply to other lists that support pagination. For example, if your website has a general article list homepage and needs pagination, the rules may be similar to:archiveIndex===/articles(-{page}).htmlThis, the second page of the article's homepage may be/articles-2.html.
It should be emphasized that the brackets(-{page})The content in it, including the dashes, can be guaranteed{page}Adjusting the variable within the enclosed premise. For example, you can also write(page/{page})to generate/article/news/page/2such a URL, but make sure it is consistent with your overall URL design. The key is{page}is recognized as a pagination variable, and its wrapping structure allows this part to be omitted when on **page.
After configuration is complete, please make sure to save in the pseudo-static rule management interface on the background, and perform detailed testing on the various list pages on the website's front end, to ensure that pagination links are generated and accessible correctly, and no 404 errors have occurred.
Summary
{page}The variable is the key to handling list pagination in AnQi CMS custom static rules. By placing it in parentheses.(-{page})Among them, we can create pagination URLs that are both beautiful and SEO-friendly, while ensuring that the page URLs are concise without page number suffixes. Reasonable static rules not only enhance the professionalism of the website but also provide a more friendly access experience for search engines and users.
Frequently Asked Questions (FAQ)
1. If I forget to add it in the custom static rules.(-{page})Will the pagination function be affected?If your list page supports pagination, but the corresponding pseudo-static rules do not include(-{page})Variable, then when the user accesses the second page or later pages, the system will not be able to generate the correct static URL.This could lead to the inability to access these pagination pages (for example, a 404 error), or even if they can be accessed, their URLs may be in a dynamic parameter form, thereby losing the SEO advantages of pseudo-static pages.
2. Besides(-{page})Can I use/page/{page}/This format to represent pagination?Can. The pseudo-static rules of AnQi CMS allow you to{page}perform some customization on the external wrapping structure of variables. For example, you can(-{page})Replace(page-{page})or(/page/{page})all of them are acceptable. The key is{page}The variable itself is recognized, and the optional part it is in can be correctly parsed. But please note that, regardless of the form, make sure it matches the pagination tags in your template. paginationThe generated link format matches, and it is fully tested after configuration.
3. In the custom rewrite rules,{page}When does the value of the variable take effect, will the page URL contain it?
{page}The value of the variable usually takes effect from 2, indicating the second page. When your list is on the page, due to(-{page})The special design, the URL will not contain page number information. For example, if the rule iscategory===/{module}/{catname}(-{page}).html, then the page URL will be/article/news.html, and the URL for the second page would be/article/news-2.html. This design makes the first page or category list page URL of the website more concise and avoids redundancy./article/news-1.htmlForm.