How to use the `url_token` in the `category` object to build the link of the category?

Calendar 👁️ 79

In Anqi CMS, building clear and accessible links for your website content is a key factor in optimizing user experience and search engine rankings. Among them, usingcategoryWithin the objecturl_tokenTo build a category link is an efficient method that conforms to SEO**practices.

Understandingurl_tokenThe role of category links.

url_tokenIs an AnQi CMS that provides a unique identifier for each category, usually a short, descriptive English word or pinyin, used to represent the category in URLs. It is not like the category ID that is just a number,url_tokenReadability and meaning, for example, a category named “News Dynamic”, itsurl_tokenmay be set to “news” or “xinwen”.

Why is this important? When search engines crawl your website, they prioritize pages with clear, descriptive URLs. A page that includesurl_token categorized links likehttps://www.yourwebsite.com/newsCompared tohttps://www.yourwebsite.com/category_id=123This kind of link can make search engines better understand the page content and also enhance users' trust in the link. When sharing or remembering the link, it is concise and meaningfulurl_tokenIt is also more popular.

How to get the category'surl_token?

To build the category link, you first need to get the correspondingurl_token. There are several ways to easily get this information in Anqi CMS.

When you get the document details through the API (archiveDetail), the returneddataobject will contain acategorysub-object. Thiscategoryobject describes in detail the classification information of the document, including url_tokenfield directly. For example:

"category": {
  "id": 1,
  "title": "AnqiCMS帮助",
  "url_token": "goruning", // 这里的 "goruning" 就是该分类的 url_token
  // ... 其他分类信息
}

In addition, when you need to get the category list (categoryList) the API also directly provides each category item withurl_token. Whether you want to display the link to the category of a single document or list all categories in the navigation bar or sidebar, you can obtain the required information in this way.url_token.

The actual operation of building the category link

Nowurl_tokenBuilding the link for the category becomes very direct. You need the root domain of the website, which is configured in the Anqi CMS system settings.BaseUrlFor example, if your websiteBaseUrlIshttps://en.anqicms.comwhile a certain categoryurl_tokenIshelpthen the complete link of that category can be simply concatenated as:

{BaseUrl}/{url_token}

To be specific, it is:https://en.anqicms.com/help

This construction method is concise and clear, convenient for users, and very friendly to search engines. It is worth noting that Anqi CMS usually adopts this flattened URL structure, that is, categorizedurl_tokenFollowed directly after the domain name. If your website is configured with more complex routing rules, such as in the moduleurl_tokenThen followed by the categoryurl_token(such ashttps://en.anqicms.com/news/industry-news),Then you need to concatenate according to the actual route configuration. But the core idea is to useurl_tokenas part of the URL path.

Summary

make effective use ofcategoryWithin the objecturl_tokenTo build classification links is an important part of AnQi CMS content operation.It not only makes the structure of your website URL clearer and easier to manage, but also directly improves the performance of the website in search engines and the user experience.By simple concatenation, you can create a professional and well-readable category page link.


Frequently Asked Questions (FAQ)

  1. Question:url_tokenCan it contain Chinese characters or special characters?Answer: Generally speaking,url_tokenIt is recommended to use a combination of letters, numbers, and hyphens (-), avoiding Chinese characters or other special characters. Although some systems may support Chinese URLs, for compatibility, SEO effects, and to avoid encoding issues, standardized English is preferred.url_tokenIs **select. The Anqi CMS also clearly points out in the document that custom URL aliases only support numbers and letters, and it is recommended to follow this rule.

  2. Ask: If I change the category ofurl_token, will the old link become invalid?Answer: Change the category ofurl_tokenAfter that, the old link will indeed become invalid. In order to avoid users from accessing the 404 error page and the negative impact on search engines, it is strongly recommended that you changeurl_tokenAfter that, immediately set up a 301 permanent redirect on your server. This will direct the old URL to the new URL, ensuring that traffic and ranking are smoothly transferred.

  3. Ask: Each category'surl_tokenmust be unique?Answer: Yes, each category'surl_tokenshould be unique under its respective module.url_tokenAs a unique URL alias for the category, if duplicates exist, the system will not be able to correctly parse user requests, leading to inaccessible pages or content confusion. Anqi CMS will strictly require this in its design.url_tokenThe uniqueness, to ensure routing accuracy.

Related articles

Why does the document detail have `price` and `stock` fields, even though the document is not a product type?

When using AnQiCMS to manage website content, many users may notice a phenomenon: even for ordinary articles, news, and other non-product type documents, the returned data structure still contains the `price` (price) and `stock` (inventory quantity) fields when their details are retrieved through the API.This may seem confusing at first glance, but after understanding the design philosophy of AnQiCMS, it will be found that this is exactly the embodiment of its powerful flexibility and scalability.AnQiCMS is designed at the bottom level

2025-11-09

If multiple recommended properties exist in the `flag` field (such as 'hc'), what characteristics does the document have simultaneously?

How to make important information stand out in the vast sea of content on a website and be discovered by users first is the focus of every operator.AnQiCMS (AnQiCMS) provides us with a very flexible and powerful tool for managing the display priority and characteristics of content - that is the `flag` field.This little field, yet contains huge potential for content operation.The mystery of the `flag` field: the叠加effect of multiple attributes In Anqi CMS, the `flag` field plays the role of document "recommended attribute" or "characteristic mark".

2025-11-09

How to optimize API requests to improve user experience when loading document details on the front-end page?

In website operation, user experience is always a core consideration. When visitors click into a document detail page, they expect a smooth, fast and secure content loading experience.AnQiCMS (AnQiCMS) provides a powerful and flexible API interface, allowing us to carefully design the document loading mechanism of the front-end page, thereby significantly improving user satisfaction.**Understanding the Core: The Power and Details of the `archiveDetail` Interface** When we talk about loading document details, the focus is initially on the `archiveDetail` interface

2025-11-09

How to implement the increase of document views (`views`) or update of other fields through API?

When you are running a website, you often need to manage content data in a fine-grained manner, such as tracking the number of views of articles, or modifying other properties of documents in specific scenarios.AnQiCMS provides a powerful API interface, making these operations possible.This article will introduce you in detail on how to use these interfaces to increase the document page views or update other fields. ## Learn about the API interaction mode of Anqi CMS In Anqi CMS, operations on document data are mainly divided into retrieval (read) and writing (creation/modify).for reading data

2025-11-09

How to handle the display of front-end images if the `thumb` or `logo` field returned by the document detail interface is empty?

When building a website with AnQiCMS, we often retrieve detailed document information from the backend interface.Among them, images are an indispensable part of content display, and the `thumb` (thumbnail) and `logo` (logo) fields are particularly important, as they are usually used in article lists, the top or sidebar of detail pages, and other locations.However, in actual development, we may encounter situations where these fields return empty.How should we handle it elegantly when the front-end gets an empty value, to ensure the friendliness of the user interface (UI) and the integrity of the content

2025-11-09

How does the key-value pair structure (`key => item`) in the document details correspond to the backend custom field settings?

When using AnQi CMS to manage website content, you often see a field named `extra` in the data returned by document detail or document list interfaces (such as `archiveDetail` and `archiveList`).This field is specifically used to carry custom information we set for the document model.Understanding the structure of the `extra` field and its correspondence with backend custom fields is crucial for front-end development and content management.

2025-11-09

How to query all custom field information contained in a model (such as an article model)?

The Anqi CMS, with its powerful content model and flexible custom field features, provides great convenience for website operators.These custom fields are the key to the personalization and data structuring of website content.How can you accurately query all the custom field information contained in a specific model (such as an article model)?This is very useful when performing secondary development, data connection, or just to understand the system structure.

2025-11-09

How to implement reading level control for specific documents (such as paid documents) in Anqi CMS?

In AnQi CMS, implementing a reading level control (`read_level`) for specific documents (such as paid documents or exclusive member content) is a very practical feature. It helps us better manage content permissions and achieve differentiated content operations.This mechanism is not only flexible, but also closely integrated with the user system, allowing us to determine what content users can see based on their identity or payment status. Next, we will explore how to efficiently use `read_level` in Anqi CMS to implement document access control.###

2025-11-09