In AnQiCMS,url_tokenIt is a crucial concept, not just a field in a document list, but also a core element in building a website's friendly URL (Friendly URL).Understanding its role and usage can help us better optimize the website structure, improve user experience, and search engine rankings.
url_tokenThe role in the document list results
When we retrieve the document list through the AnQiCMS API, for example, callingarchive/listinterface, each document data returned will contain a field namedurl_tokenThe field. This field represents the 'URL alias' or 'Slug' of the document.It is a short, descriptive string that is usually derived from the document title or related keywords and is used as a unique identifier for the document.
In the document list results,url_tokenits presence means that we do not need to rely on the internal document ID (id) to build a link that can directly access the document. It will beyourdomain.com/archive?id=123This address is not friendly to users and search engines, it is converted intoyourdomain.com/news/anqicms-tutorialThis address is more readable and meaningful. At the same time, when you need to obtain specific document details,archive/detailthe interface also allows us to usefilenameThe parameter (its value isurl_token) is used to replace the document ID for querying, which greatly enhances the flexibility of the system and the convenience of external integration.
How to utilizeurl_tokenGenerate a friendly URL
The mechanism for generating friendly URLs in AnQiCMS is centered aroundurl_tokenexpanded.
Firstly, when publishing or editing content, AnQiCMS provides us with customurl_tokenThe ability. When we create a new article, a product, a category, or a tag in the background, the system usually generates a default one based on the title you enter.url_tokenFor example, if the article title is 'AnQi CMS Content Operation Tutorial', the system may automatically generateanqicms-content-operation-tutorialsuch as this.url_tokenOf course, we can manually modify it as needed to make it more in line with SEO strategies or brand style. This customizedurl_tokenThe field supports numbers and letters, it is usually recommended to use hyphens (-) to separate words to improve readability.
Onceurl_tokenSet, AnQiCMS will take it as a part of the website URL structure for the content item. Specifically, friendly URLs usually adopt域名/模型别名/url_tokenor域名/分类别名/url_tokenThe form. For example, an article belonging to the "news" model,url_tokenWithanqicms-updateThe final friendly URL of the article might be,https://www.yourwebsite.com/news/anqicms-update.
For categories and tags pages,url_tokenThe way it works is similar. For example, a category named "Product Center", itsurl_tokenmay be set toproductsThen the URL of the category page might behttps://www.yourwebsite.com/products. When the user clicks on this link, the system will be able to find the corresponding category page and display the content list below it.url_tokenAccurately find the corresponding category page and display the content list below it.
This is based onurl_tokenThe friendly URL mechanism brings obvious benefits.It makes the website URL structure clearer and more logical, not only making it easier for users to understand the content of the page, but also allowing search engine spiders to more effectively crawl and index website information, thereby improving the overall SEO performance of the website.In the daily operation, we should make full use ofurl_tokenThe custom feature, carefully designing the URL alias for each item, making it concise and clear, and containing core keywords, maximizing the advantages of a friendly URL.
Frequently Asked Questions (FAQ)
1. If I do not set it manuallyurl_tokenHow will AnQiCMS handle it?Answer: If you do not manually set it when publishing or editing contenturl_token,AnQiCMS will automatically generate one based on the title of the contenturl_token. The system will attempt to convert Chinese characters or other non-English characters in the title to pinyin or remove them, and use hyphens to separate them to ensure the generatedurl_tokenconforms to URL standards.
2. Change published contenturl_tokenWill it affect SEO?Answer: Change published contenturl_tokenThe URL address that changes the content indeed has an impact on SEO.Because search engines have indexed the old URL, sudden changes can cause the old link to fail, resulting in the loss of some traffic and rankings.To minimize the negative impact, it is strongly recommended to changeurl_tokenAfter that, set up a 301 redirect (permanent redirect) immediately, pointing the old URL to the new URL, which can guide search engines and users to visit the new address and pass the SEO weight of the old link.
3.url_tokenCan it be repeated? For example, the same under different categoriesurl_tokenarticles?Answer: Generally speaking,url_tokenIt needs to be unique within its level and type (such as articles, categories, etc.) to avoid URL conflicts. But under some URL routing configurations, such as域名/分类别名/文章url_tokenThis structure allows articles in different categories to be the sameurl_tokenBecause their complete URL paths are different. AnQiCMS is designed to ensure that the final generated complete URL is unique, and if you try to create a duplicate at the same level.url_tokenThe system will prompt or automatically add a suffix to distinguish.