How to implement different URL parsing strategies for different content types (articles, products, pages) in AnQiCMS?

Calendar 👁️ 56

In AnQiCMS, applying different URL parsing strategies for different content types such as articles, products, and pages is a key step to optimizing website structure, improving search engine optimization (SEO) and enhancing user experience.AnQiCMS has powerful static rule management and flexible content model design, making this requirement easy to achieve.

The foundation of content model and URL structure

One of AnQiCMS's core advantages lies in its 'flexible content model'.The system divides the website content into different models, such as the default "article model" and "product model", as well as other models that you can customize according to your business needs.In addition, the single-page content also has its independent management mechanism. It is this model-based classification management that lays a solid foundation for our customized URL parsing strategy.The system can clearly distinguish what you are operating, whether it is an article, a product detail page, or a service page, and thus apply the corresponding URL rules.

AnQiCMS URL parsing strategy overview

AnQiCMS has built several pseudo-static rules to meet the needs of different scenarios.You can find the 'Static Rules' setting item under the 'Function Management' menu in the background.System Provided:

  1. Numeric mode:The main use of content ID numbers in URLs, concise but lacks semantics.
  2. Model naming pattern:The URL includes the model name, which helps identify the content type.
  3. Categorization naming pattern 1/2:The URL includes the category name, strengthening the hierarchical relationship of the content.

These preset modes are convenient, but if you want to have more refined and SEO-friendly control over the URL structure, then 'Custom Mode' will be your first choice.The custom pattern gives you the ability to tailor the URL structure for different content types.

Deep customization: Custom URL parsing rules.

You need to enable the 'custom mode' of AnQiCMS to implement different URL parsing strategies for different content types.This allows you to define separate URL structures for core content types (articles/products, categories, single pages, etc.)

In Custom Mode, AnQiCMS provides a series of available variables to help you build logical and semantic URLs:

  • {id}: Unique ID of the content.
  • {filename}The custom URL alias of the content, usually the pinyin or manually set English keywords.
  • {catname}Custom URL alias for a category.
  • {module}The URL alias of the model the content belongs to (e.g.,)articleRepresents the article model,productRepresents product model).
  • {page}: Page number (used when the URL contains pagination information).

By using these variables, you can freely combine and design URL paths that meet SEO requirements and are easy for users to understand.

Configuration example and explanation:

In the configuration interface of the custom mode, you will see several groups of rules, of which the main ones are directly related to articles, products, and pagesarchive/categoryandpage:

  • Targeting articles and products (archiveRules):By default, articles and products belong to the category of "documents" and are sharedarchiverules.

    • Semantic URL example: archive===/{module}/{filename}.html
      • {module}Will automatically be replaced with the model alias of the content (such asarticleorproduct)
      • {filename}Will be replaced by the unique alias set in the "Custom URL" field in the background of the article or product.
      • Effect: /article/anqicms-tutorial.htmlor/product/latest-smartphone-model.htmlSuch URLs can indicate the content type and contain keywords, which are very friendly to search engines and users.
  • For category pages (categoryRules):The URL of a category page usually reflects its hierarchical relationship.

    • Semantic URL example: category===/{module}/list-{catname}.html
      • {module}Replace with model alias.
      • {catname}Replace with the alias set in the "Custom URL" field in the backend for this category.
      • Effect: /article/list-web-operations.htmlor/product/list-electronics.htmlYou can add pagination if needed.(-{page})such ascategory===/{module}/list-{catname}(-{page}).html.
  • For single-page pages (pageRules):Single pages such as "About Us",

    • Semantic URL example: page===/{filename}.html
      • {filename}Replace it with the alias set in the "Custom URL" field of the single page in the backend.
      • Effect: /about-us.htmlor/contact.html

Practical Application: Optimizing URLs for Different Content Types

In the AnQiCMS backend, setting a 'Custom URL' for each content type is the key to implementing the above strategy:

  1. Articles and Products:When publishing or editing an article/product, find the "Custom URL" field. The system will automatically generate a pinyin alias as the default value, but it is strongly recommended that you manually modify it to be more descriptive and include core keywords (for example, for the article "AnQiCMS tutorial", you can set it toanqicms-tutorialEnsure that this alias is unique throughout the site.

  2. Category:When adding or editing a category, there will also be a "custom URL" field. Here you can set a concise and representative English alias for your category (for example, for the "website operation" category, you can set it asweb-operations)

  3. Single page:When creating or editing a single page in the page management, set its "custom URL" field. For example, set the "About Us" page toabout-usand get/about-us.htmlsuch a friendly URL.

Operation steps and precautions

To apply these strategies, please follow these steps:

  1. Log in to the AnQiCMS backend, go to "Function Management" -> "URL Rewrite Rules".
  2. Select "Custom Mode".
  3. Edit the URL structure according to your needs (such asarchive/category/page). Make sure the variables you use are correct and the path structure is clear.
  4. Save your changes.
  5. Important reminder:After modifying the pseudo-static rules, be sure to test your website in different browsers or incognito mode to ensure that all links can be accessed normally without any 404 errors.
  6. 301 Redirect:If your website has been online for a while and you are modifying the old URL structure, it is strongly recommended that you use AnQiCMS's '301 Redirect Management' feature to permanently redirect the old URL to the new one.This can effectively avoid the decrease in search engine rankings and the interruption of user access due to URL changes.

By using AnQiCMS's flexible URL parsing strategy, you can build logical, semantic-rich, and search engine-friendly URLs for various content on your website, thereby enhancing the overall performance of the site.


Related articles

How to balance beauty and information integrity when displaying long URLs with the `urlizetrunc` filter?

In website operation, a beautiful user interface and complete information presentation are key to attracting and retaining visitors.Especially when dealing with URL links, we often encounter a dilemma: is it better to let the long link destroy the page layout, or to truncate it and possibly lose some information?A safe CMS provides a very practical solution, that is the `urlizetrunc` filter, which cleverly balances these two needs.

2025-11-09

Does the `urlize` filter also force the addition of the `rel="nofollow"` attribute to internal links?

When using AnQiCMS for content creation and template development, we often encounter issues related to link handling. One common and key question is whether the `urlize` filter will also force the addition of the `rel="nofollow"` attribute to site internal links when converting URLs in text to links?This is an indispensable detail for the website's SEO strategy.

2025-11-09

How to use the `urlize` filter in the TDK description of a website (`meta name="description"`)?

In AnQi CMS, the TDK settings of the website are crucial for search engine optimization (SEO).`meta name="description"` as the page summary displayed to users by search engines, the quality of its content directly affects the click-through rate.When discussing how to use the `urlize` filter in the `meta name="description"` tag, it is first necessary to deeply understand the basic functions and **practice** of both.

2025-11-09

Will the `urlize` filter-generated links add any CSS classes or IDs for styling control?

The Anqi CMS template system provides flexible and powerful tools for content display, among which the `urlize` filter can intelligently convert plain text URLs and email addresses into clickable hyperlinks, greatly enhancing the readability and interactivity of the content. However, for many users who want to finely control the appearance of the website, a common question is whether the `urlize` filter will add specific CSS classes or IDs when generating these links for styling control?

2025-11-09

Does the `urlize` filter support recognizing and converting IP address formatted URLs (e.g., `http://192.168.1.1`)?

In the daily use of AnQi content management system (AnQiCMS), template filters are an important tool for processing and displaying data.Among them, the `urlize` filter is often used for its convenience, to automatically convert URLs and email addresses in text content into clickable hyperlinks, and to automatically add the `rel="nofollow"` attribute to these links. This is very useful for handling user-generated content (UGC) or automatically identifying links in article text.### `urlize`

2025-11-09

Is there a global option in the AnQiCMS background settings that affects the behavior of `urlize` and `urlizetrunc`?

When using AnQiCMS to manage website content, we often encounter the need to automatically convert URLs or email addresses in text to clickable links.`urlize` and `urlizetrunc` are powerful tools to implement this function.They can not only automatically identify links in text but also automatically add the `rel="nofollow"` attribute to links after conversion, which is very practical for SEO optimization.However, many friends may be curious when using these filters

2025-11-09

Does the `urlize` filter-generated link include the `title` or `alt` attributes of the original URL?

In Anqi CMS templates, the `urlize` filter can effectively convert URLs in text content into clickable HTML links.For many users, while using this convenient feature, they are also concerned about whether the generated link will automatically include `title` or `alt` attributes to enhance user experience or optimize SEO.

2025-11-09

How to make `urlize` output HTML links correctly without using the `safe` filter?

The AnQiCMS template system provides a solid foundation for content operations with its powerful functions and flexible customization.In daily content display, we often encounter the need to automatically convert URLs in plain text to clickable HTML links.The `urlize` filter is designed for this purpose, it can intelligently recognize URLs or email addresses in text and wrap them in `<a>` tags.However, a common practice when using the `urlize` filter is to pair it with the `|safe` filter

2025-11-09