How do variables such as `{id}`, `{filename}`, `{catname}`, `{module}` and others affect the display structure of the URL in static rules?

Calendar 👁️ 71

When operating a website, we often pay attention to the quality of the content, the performance of the website, but there is a detail that is often overlooked, yet it is crucial, that is, the structure of the URL (Uniform Resource Locator).A clear and meaningful URL can not only enhance user experience, but is also an indispensable part of search engine optimization (SEO).Our company, Anqi CMS, is well-versed in this, providing flexible and powerful URL rewriting functions that allow us to customize URLs that are both aesthetically pleasing and SEO-friendly according to our needs.

Today, let's delve into the pseudo-static rules of Anqi CMS and the variables enclosed in curly braces, such as{id}/{filename}/{catname}/{module}Wait, how do they cleverly affect the display structure of our website URL.

SEO Static: Making dynamic content have the elegance of a static URL.

First, let's briefly review what pseudo-static is.Our website content is usually dynamically generated, such as displaying articles, product information read from the database.yourdomain.com/article.php?id=123&category=newsThis does not look beautiful, nor is it conducive to search engines understanding the page content. Static rewriting technology is to rewrite such dynamic URLs through server rules, so that they appear to users and search engines as similar to static HTML files, such as becomingyourdomain.com/article/123.htmlHowever, the page content is still dynamically obtained.

The pseudo-static management function of Anqi CMS is very powerful, it is built-in with several commonly used modes for us to choose from, such as numeric mode, model naming mode, etc.Even better, it also provides custom patterns, allowing us to freely combine various variables according to specific needs, creating unique URL structures.These variables are like the 'building blocks' of a URL, the combination of which determines the final URL form.

Unveiling the 'building blocks' of URL construction: Core variable explanation

In AnQi CMS, we mainly encounter the following key variables in the custom pseudo-static rules:

{id}: The unique numeric identity of the content

{id}A variable represents the numeric ID of the content, which is usually a unique identifier in the database for articles, products, categories, etc.It is concise and direct, ensuring that each content address is unique.

For example, if our pseudo-static rule is set toarchive===/{module}/{id}.htmlThen an article with an ID of123The article's URL may be displayed asyourdomain.com/article/123.html.The benefit of this pattern is that the URL structure is very clear, easy for internal system management and identification.But the drawback is that users and search engines can only see a series of numbers, which does not give a direct understanding of the specific content of the page.

{filename}: Is a 'alias' for URL semantic injection

{filename}Variables play a role in making URLs more readable and SEO-friendly. They are usually custom link names for content, and Anq CMS automatically generates pinyin forms based on article titles, single page names, or tag names.filenameOf course, we can also manually modify this during content editingfilenameTo include more keywords to make it more SEO-friendly. It is important to note that this should be done across the entire site.filenameMust be unique, the system will automatically check and may add random numbers to ensure uniqueness.

For example, if we publish an article titled "AnQi CMS New Feature Release", the system may automatically generate afilenamesuch asanqicms-new-feature-release. If the pseudo-static rule is set toarchive===/{module}/{filename}.htmlSo the URL may becomeyourdomain.com/article/anqicms-new-feature-release.html. Such a URL allows users to see the general content at a glance, and search engines can better capture and understand the theme of the page, thus possibly bringing better rankings.

{catname}: Show the hierarchy of the "category name"

{catname}A variable is a custom link name for categories, which is usually automatically generated in pinyin from the category name, and also supports manual modification.This variable is very suitable for constructing URLs with a sense of hierarchy, clearly showing the category of the content.

For example, there is a category named "Company News", itscatnameIt could becompany-news. If we set the pseudo-static rule toarchive===/{catname}/{filename}.htmlSo, an article under the "Company News" category, the URL may display asyourdomain.com/company-news/anqicms-new-feature-release.htmlThis structure not only helps users understand the navigation path of the website, but also passes the information of the content organization structure to search engines.

{module}: Clarifies the "model alias" of the content type.

{module}The variable refers to the URL alias of the content model, which is defined in the content model settings and supports only lowercase English letters.In Anqi CMS, we can create different content models, such as articles (article), products (product), activities (activity), and so on.{module}Variables are used to distinguish between different types of content.

For example, if our article model alias isarticle, and the product model alias isproduct, then usingarchive===/{module}/{id}.htmlrules, an article with ID123The article and ID is for456The product, their URLs will be displayed asyourdomain.com/article/123.htmlandyourdomain.com/product/456.htmlThis makes the website structure more standardized, allowing users to clearly identify the type of content displayed on the current page.

Other auxiliary variables:{catid}and{page}

In addition to the aforementioned core variables, Anqicms also provides{catid}(Category ID) and{page}(pagination page number) and other auxiliary variables.{catid}with{id}Similar, but a numeric ID specifically used for categories.{page}It is very useful when pagination is needed on the list page, usually placed in parentheses to indicate optional, for example(/{page}).

Flexible combination: Customize your exclusive URL structure

The AnQi CMS custom pseudo-static rules adopt the format of "rule name===rule value". The rule name (such asarchiverepresents the document detail page,categoryrepresents the document list page,pagerepresents a single page,tagIt indicates that the label detail page, etc., is fixed, while the rule values can be freely combined with the variables mentioned earlier.

For example, a typical custom rule combination might be:

  • Document Details Page: archive===/{module}/{catname}/{filename}.html

    • Example URL: yourdomain.com/article/company-news/anqicms-new-feature.html
    • Parsing: articleIs a model alias,company-newsIs a category alias,anqicms-new-featureIs the file name of the article. This structure includes the content type, shows the hierarchical relationship, and integrates keywords, which is highly recommended for SEO-friendly URLs.
  • Document List Page: category===/{module}/{catname}(-{page})

    • Example URL: yourdomain.com/article/company-news/(First page) oryourdomain.com/article/company-news-2.html(Page 2)
    • Parsing:The list page is composed of model alias and category alias, and supports optional pagination.

Through such a flexible combination, we can create highly customizable and

Related articles

How to correctly display Markdown formatted mathematical formulas and flowcharts in AnQiCMS content?

For many content creators, especially when it comes to technical articles, tutorials, or data reports, it has always been a challenge to clearly and accurately display mathematical formulas and complex flowcharts on web pages.The traditional HTML editing method is not only繁琐but also prone to errors.It is fortunate that the new version of AnQiCMS has introduced support for Markdown editors, which brings great convenience to handling such complex content.It makes the creation of technical content more efficient and elegant.

2025-11-07

How `include`, `extends`, and `macro` auxiliary tags optimize the template structure and affect the final display of content?

In website operation, template design is a key link in building user experience and content presentation efficiency.AnQiCMS (AnQiCMS) provides strong support for content management with its flexible template engine.Especially among the auxiliary tags such as `include`, `extends`, and `macro`, they do not directly modify the content itself, but through optimizing the template structure, they profoundly affect the final display effect and maintenance efficiency of the website content.

2025-11-07

How to format the timestamp label `stampToDate` to display time data in a readable format?

In a content management system, time data often exists in the form of a series of numbers, which we call a Unix timestamp.This form is very efficient for machine processing, but for us users, a string like `1678886400` is obviously not intuitive to understand the date and time it represents.AnQi CMS knows this point well, therefore it provides a very practical template tag `stampToDate`, which helps us convert these cryptic timestamps into the date and time format we are accustomed to reading.###

2025-11-07

How `if` logical judgment tags and `for` loop iteration tags control the conditional display and repeated display of content?

In the daily operation of Anqi CMS, we often need to decide which content should be displayed according to different business logic, as well as how to efficiently repeat the display of a large amount of similar content.At this time, the `if` logical judgment tag and the `for` loop traversal tag have become indispensable tools in template design.They allow us to flexibly control the conditional display and repetition of content, greatly enhancing the dynamicity and maintainability of the website.### The conditional display tool - `if` logical judgment tag The `if` tag is the basis for conditional content display in Anqi CMS templates

2025-11-07

How do the settings for image download, Webp format, large image compression, and thumbnail processing methods affect the display effect of the image in the content?

During the operation of a website, the presentation effect of images often directly affects user experience and the professionalism of content.Slow loading speed, inconsistent dimensions, format incompatibility, and other issues may cause visitors to leave.Fortunately, AnQiCMS provides us with a variety of powerful image processing features in the content settings, allowing us to manage images finely and create an excellent visual experience for website content.Next, let's delve deeper into how these features affect the display of website images. ### 1.

2025-11-07

How to efficiently convert the first letter of an English string to uppercase in AnQi CMS template?

In AnQi CMS template development, string formatting is a common requirement.Whether it is to display the title of an article, the nickname of a user, or the category name, sometimes we need to ensure that they are presented in a specific letter case, such as capitalizing the first letter of the English string.The powerful template engine of Anqi CMS provides a variety of flexible filters (Filter) to help us complete these tasks efficiently.### Meticulously using the `capfirst` filter: Capitalize the first letter Used to capitalize the first letter of an English string

2025-11-07

How to convert the entire English string to lowercase in AnQi CMS template?

In Anqi CMS template design, we often need to format the displayed content to match the overall style of the website or specific display requirements.When encountering a situation where it is necessary to convert an English string to lowercase, Anqicms provides a very convenient and intuitive template filter (Filter) to help us achieve this goal.

2025-11-07

What method does the AnQi CMS template provide to convert all letters of a string to uppercase?

In website content management, unified text format is an important factor in improving user experience and website professionalism.Especially for English strings, sometimes it is necessary to convert them all to uppercase to emphasize, standardize, or display the brand.AnQiCMS provides a flexible 'Filter' function in template design, making this operation very simple and intuitive.

2025-11-07