As an experienced website operations expert, I know that how to flexibly and efficiently locate and obtain specific content in a content management system is the key to improving operational efficiency and website SEO performance.AutoCMS (AutoCMS) provides very practical mechanisms for single-page management, in addition to the most common method of specifying single pages by ID, there are also parameters that are more in line with operational thinking that can be used.Today, let's delve deeper into this topic.


Advanced Single Page Call of AnQi CMS: In addition to ID, you can also locate content efficiently through these parameters

In the AnQi CMS, single pages (such as "About UsBy default, when we mention locating a single page, most people will think of identifying it through its unique numeric ID.This is indeed an accurate and correct method, just like everyone has a unique ID number.However, in the actual operation of websites, pure numeric IDs are often not intuitive and lack SEO-friendliness, especially when developing templates or migrating content. Hard-coded IDs are more likely to cause maintenance difficulties.

Then, in addition to ID, what 'more intelligent' parameters does the security CMS provide to specify the single page to be retrieved? The answer lies in the ——URL alias (also known as custom URL, usually corresponding to template tags in AnQiCMS)tokenparameter).

URL alias: let a single page have a "personalized nickname"

Imagine, if you want to reference the 'About Us' page, would it be more convenient to use its ID '123' in the database, or a clear and easy-to-understand 'about-us'?It is clearly the latter.Auto CMS is well-versed in this, providing a 'Custom URL' setting for each page.

This custom URL, which we refer to as URL alias, has the following core features and advantages:

  1. Intuitive and easy to understand, convenient to memorize:Operators can name page aliases with meaningful English words or pinyin (for exampleabout/contact-us) to make it easier to remember and manage than dry numbers.
  2. SEO-friendly:Search engines prefer descriptive URLs, an URL alias containing keywords can help improve the page's search engine ranking. For example,yoursite.com/about-us.htmlvs.yoursite.com/page-123.htmlmore semantic.
  3. Template invocation is flexible:In the template, you can directly use this URL alias to accurately obtain the content of a specific page without having to search for its ID on the backend.
  4. Uniqueness guarantee:In the AnQi CMS backend, when you set the custom URL for a single page, the system will prompt that the alias must ensure its uniqueness across the entire site.Even if you manually enter a duplicate alias, the system will automatically add a random number at the end to ensure its uniqueness and avoid content conflicts.

In the backend management interface of AnQi CMS, when you edit or create a single page, you will see an 'Custom URL' input box.By default, if you do not fill in, the system will automatically generate a pinyin form of URL alias based on the page name you enter.Of course, you can also manually modify it according to your own needs, for example, changing it to a more concise and internationally standardized English alias.

In the template throughtokenCall parameters accurately

Understood the concept of URL alias (custom URL), we can then apply it to template development to achieve getting single-page data through this "nickname". In the template tag system of AnQi CMS,pageDetailTags are used to get detailed information about a single page. Besidesidbesides the parameters, it also supports a key parameter:token.

tokenThe parameter is used to receive the single page URL alias set by our backend. When you need to obtain the data of a specific single page in the template but find it inconvenient or don't want to use its ID, you can usetoken.

Example code:The custom URL for your 'About Us' page is set toaboutIf you want to display the title and content on the page, you can write it like this:

{# 获取URL别名为“about”的单页标题 #}
<div class="page-title">
    {% pageDetail with name="Title" token="about" %}
</div>

{# 获取URL别名为“about”的单页内容 #}
<div class="page-content">
    {% pageDetail with name="Content" token="about" %}{{ pageContent|safe }}
</div>

Through this way, your template code becomes more readable and easier to maintain.Even if the ID of this single page changes in the future (for example, data migration), as long as the URL alias remains the same, your template code will still work normally and no modification is needed.

Distinguish custom template files from page call parameters

It is worth mentioning that Anqi CMS also supports specifying a "single page template" for individual pages (for examplepage/about.html)。This might raise some doubts among operators: Can I directly specify the single-page acquisition through the file name?about.htmlIs it possible to specify the single-page acquisition through the filename?

It needs to be clarified that the concept of:The custom template file determines how to renderthe single page content you obtain, whileIDandtokenthe parameters determine which single page you obtaindata.

when you create a namedpage/about.htmlThe template file, and in the background set a single page (such as ID 123, URL alias)aboutThe "About Us" page) single page template toabout.htmlwhen, meaning that when this "About Us" page is accessed, the system will usepage/about.htmlThis template is used to display its content. However, in the URL address or template tags, we still need to go throughID(such asyoursite.com/page-123.html) ortoken(such asyoursite.com/page/about.htmlIf the pseudo-static rules configuration allows, use it to specify that the page to be accessed is 'About Us'. The template file itself cannot be used as a parameter to directly 'fetch' page data.

In short,tokenThe parameter (URL alias) is a 'semantic identifier' provided by Anqi CMS for single-page websites. It is similar to traditional IDs in that it can accurately specify the single-page you want to retrieve.Using URL aliases can not only make your website URL more attractive, improve SEO, but also greatly simplify template development and content management work.


Common Questions (FAQ)

  1. 问:URL别名(English)token)和ID都能定位单页,我应该优先使用哪个?English Answer:在大多数情况下,建议优先使用URL别名(English)token)。It has better readability, SEO-friendliness, and when adjusting content in the background (such as ID changes), as long as the alias does not change, the template code usually does not need to be modified, making it easy to maintain.ID although accurate, is more inclined towards technical level identification.Only consider using the ID when the URL alias is uncertain or when specific operations need to be performed based on the system internal ID.

  2. 问:If I set a custom URL alias for a single page, will the URL to access that single page change? Answer:The. Anqi CMS supports pseudo-static rules, when your pseudo-static rule configuration allows the use of URL aliases (for examplepage/{filename}.html),Set a custom URL alias for a single page, and its access address will become such asyoursite.com/page/your-custom-alias.htmlThis is the key role of URL alias in SEO and user experience. Be sure to ensure that the 'pseudo-static rules' are correctly configured in the background.

  3. 问:Can I set multiple URL aliases for the same page in the background? Answer:Cannot. Each page can only have one unique URL alias. Anqi CMS strictly requires the uniqueness of URL aliases to avoid ambiguity when the system parses requests