Which file path variables are available when customizing the static rules?
Hello! As an old soldier who has been deeply involved in website operation for many years, I know that a flexible and powerful static mechanism is crucial for the search engine optimization (SEO) and user experience of the website.AnQiCMS (AnQi CMS) performs exceptionally well in this regard, it not only provides a variety of ready-to-use pseudo-static modes, but also allows us to deeply customize the URL structure, which undoubtedly provides great convenience for refined operation.
Today, let's delve into how we can flexibly use the key file path variables available in Anqi CMS when customizing pseudo-static rules, and how to cleverly apply them to create more attractive website URLs.
Unlock the secret of AnQiCMS pseudo static: In-depth analysis of the core variables in the URL path
Today, in the increasingly intense digital marketing environment, a website's URL (Uniform Resource Locator) is no longer just a technical address; it is also an important basis for users and search engines to understand the content of web pages and evaluate the structure of the website.A clean, meaningful, SEO-friendly URL that can significantly improve the click-through rate and ranking of a website in search engines.AnQi CMS fully understands this, and its powerful pseudo-static function is precisely designed to meet this need.
The pseudo-static function of AnQi CMS, in short, is to convert dynamically generated page addresses (such as/?id=123&cat=456Rewritten by the server to look like a static HTML file address (for example)/news/technology/anqicms-features.htmlBut the content of the page is still dynamically extracted and rendered from the database.This approach maintains the flexibility of dynamic websites while also having the SEO-friendliness and readability of static URLs.When we need to control the URL structure more finely, the custom static rules provided by Anqi CMS become our powerful assistant.
Core variable parsing: Dynamic elements in the URL path
In the Anqi CMS custom static rule configuration interface, you will see a series of curly braces{}Encapsulated variables. These variables are not fixed characters but are like 'magic placeholders' that will be dynamically replaced by the corresponding content data at runtime.Understanding and properly using these variables is the key to constructing a perfect URL.
Let's get to know these core variables one by one:
{id}: The unique identity of data{id}It is the most basic and commonly used variable, representing the unique numeric ID of any content in the system.Whether it is an article, product, category, or tag, Anqi CMS will assign a unique ID to it.For example, the detail page URL of an article,{id}It will be replaced with the actual ID of the article, such as/article/123.html. When customizing rules, if you want the numerical ID of the content to be included in the URL,{id}is your first choice.{filename}: Content alias, more descriptive{filename}meansdocument or single pageThe custom link name, usually also called 'slug' or 'alias'. When editing articles or single pages, Anqi CMS will automatically generate a pinyin or English phrase as the default one.filenameYou can also manually modify it. This variable makes the URL more descriptive, so you can directly understand the content of the page by the URL name, for example/products/anqicms-pro.html. Use{filename}Instead{id}Can make the URL perform better in search engines and more user-friendly.{catname}: The exclusive alias of the categorywith{filename}similar,{catname}Used specifically to representCategoryCustom link name or alias. When creating and editing categories, you can set a unique, meaningful English or拼音 alias for each category. It is referenced in the pseudo-static rules.{catname}Can construct a clear classification path, for example/news/industry-updates/page_1.htmlof whichindustry-updatesis the classificationcatnameThis is very helpful for building a clear website hierarchy.{catid}: The numeric ID of the classification{catid}As the name implies, it is the unique numeric ID of the category. If you prefer to use the numeric ID in the category URL instead of the alias, or in some special cases you need to include both the ID and the alias to ensure uniqueness,{catid}Could be put into use. For example/category/15.html.{module}: Model code, distinguishing content typeAnQi CMS supports flexible content models such as article models, product models, etc.{module}The variable represents the current content.Model table nameOr its alias in the URL. For example, the article model may correspond toarticle, the product model may correspondproduct. Through{module}You can easily distinguish different types of content in the URL, such as/article/latest-news.htmland/product/new-arrivals.htmlThis is particularly useful in multi-model websites, making the URL structure more standardized.{page}The master of pagination.When your content list needs to be displayed with pagination,{page}Variables are particularly important. They will be replaced by the current page number. It should be noted that,{page}variables must be used in pseudo-static ruleswith parentheses()enclosedFor example(/ {page})This means that when the pagination information (i.e., the first page) is not included in the URL, this part of the path will be automatically omitted to keep the URL concise; it will only be displayed when accessing the second page or later pages/page_2Or a similar structure. This is a very elegant way to handle pagination URL processing.
Combination of rules and application scenarios
In the AnQi CMS backend "fake static rules" settings, you can define rules for six different page types, namely:
archive: Document detail page (such as articles, product details)category: Document list page (category page)archiveIndex: Model homepage (such as article list homepage)page: Single page detail pagetagIndex: Tag homepagetag: Tag document list page
Each rule is followed规则名===规则值The format. For example, if you want the article detail page URL to be/article/文章别名.htmlYou can configure it like this:
archive===/article/{filename}.html
Here are some common examples of pseudo-static rules combined with the above variables, you can adjust them according to your actual needs:
Document detail page (e.g., article):
/news/{filename}.html(Recommended: Readable, includes keywords)archive===/news/{filename}.html/{module}/{id}.html(General: Suitable for various content models, short path)archive===/{module}/{id}.html
Document list page (category page):
/{catname}(/{page}).html(Readable, pagination elegant)category===/{catname}(/{page}).html/{module}/{catid}(/{page}).html(Numeric ID, pagination elegant)category===/{module}/{catid}(/{page}).html
Model Home (e.g., Product Home):
/products.html(Simple and clear)archiveIndex===/products.html/{module}/list.html(General, distinguished by model)archiveIndex===/{module}/list.html
Single Page Detail Page (e.g., About Us):
/about-us.html(Direct alias, clear)page===/{filename}.html
Tag Document List Page:
/tags/{id}(/{page})(Numeric ID, pagination elegant)tag===/tags/{id}(/{page})/tag/{filename}(/{page})(Alias, pagination elegant)tag===/tag/{filename}(/{page})
Remember,{page}Variables must be enclosed in parentheses()Enclosed, so that when accessing the first page,/the part of pagination after will be automatically omitted, for example/news/industry-updates/, rather than/news/industry-updates/page_1This can make the URL more concise and standardized.
Practical suggestions and precautions
When configuring custom pseudo-static rules, there are some tips and tricks to share with you:
- **Keep it simple and readable