Besides ID, which parameter can be used to specify the single page to be retrieved?

Calendar 👁️ 64

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.AnQiCMS provides very practical mechanisms in page management, in addition to the most common method of specifying a single page through ID, there are actually parameters that are more in line with operational thinking that can be utilized.Today, let's delve deeply into this topic.


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

In Anqi CMS, single pages (such as "About Us", "Contact Us", "Privacy Policy", etc.) are an important part of building website basic information.By default, when we mention locating a single page, most people think of identifying it by its unique numeric ID.This is certainly an accurate way, 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, hardcoded IDs are more likely to cause maintenance problems.

Then, besides ID, what "smarter" parameters does Anqi CMS provide to specify the single page to be retrieved? The answer lies in -URL alias (also known as custom URL, usually corresponding to template tags in AnQiCMS)tokenparameters).

URL alias: give a single page a 'unique nickname'

Imagine if you want to refer to the "About Us" page, should you use its ID "123" in the database, or would it be more convenient to use a clear and understandable "about-us"?It is undoubtedly the latter. Anqi CMS is well-versed in this, providing a 'Custom URL' setting for each single page.

This custom URL, which is what we call the URL alias, has the following core features and advantages:

  1. Intuitive and easy to understand, convenient to remember:Operatives can name page aliases with meaningful English words or pinyin (for exampleabout/contact-us), which is easier to remember and manage than dull numbers and IDs.
  2. SEO friendly:Search engines prefer URLs with descriptive names, a URL alias containing keywords helps improve the search engine ranking of a page. For example,yoursite.com/about-us.htmlThanyoursite.com/page-123.htmlmore semantically meaningful.
  3. The template call is flexible:In the template, you can directly use this URL alias to accurately retrieve the content of a specific single page without having to find its ID on the backend.
  4. Uniqueness guarantee:In Anqi CMS backend, when you set the custom URL for a single page, the system will prompt that the alias must be unique throughout the site.Even if you manually enter a duplicate alias, the system will automatically add a random number after it to ensure uniqueness and avoid content conflicts.

In the AnQi CMS backend management interface, when you edit or create a single page, you will see a '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 name of the page you enter.Of course, you can also manually modify it according to your own needs, such as changing it to a more concise, more internationalized English alias.

Pass in the templatetokenPrecision parameter call

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

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

Example code:Assuming your custom URL for the "About Us" page is set toabout, you want to display its 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>

In 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 unchanged, your template code will still work normally without any modification.

Differentiate 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.htmlThis may raise some doubts among operators: Can I directly specify the single-page acquisition through thisabout.htmlCan I specify the single-page acquisition through the filename

It is necessary to clarify a concept hereThe custom template file determines how to renderThe single-page content you obtain, whileIDandtokenThe parameters determine which single page you are gettingdata.

When you create a namedpage/about.htmlThe template file, and in the background set a single page (such as ID 123, URL alias asaboutThe "About Us" page) single page template to setabout.htmlIt means that when this "About Us" page is visited, 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 pass throughID(such asyoursite.com/page-123.htmlortoken(such asyoursite.com/page/about.htmlIf the configuration of the pseudo-static rule allows, it can indicate which page to access, such as the "About Us" page. The template file itself cannot directly "get" the page data as a parameter.

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


Frequently Asked Questions (FAQ)

  1. Ask: URL alias (token) and ID can locate a single page, which one should I prioritize? Answer:In most cases, it is recommended to prioritize the use of URL alias (tokenIt has better readability, SEO-friendliness, and in the background content adjustment (such as ID changes), as long as the alias does not change, the template code usually does not need to be modified, which is convenient for maintenance.ID is accurate but more biased towards technical identification. It is only considered when the URL alias is uncertain or specific operations need to be performed based on the system internal ID.

  2. Ask: If I set a custom URL alias for a single page, will the URL for accessing the single page change? Answer:Will do. Anqi CMS supports pseudo-static rules, when your pseudo-static rules configuration allows the use of URL aliases (for examplepage/{filename}.html), set a custom URL alias, and the access address will become likeyoursite.com/page/your-custom-alias.htmlThis is the key role of URL aliases in SEO and user experience. Be sure to configure the "pseudo-static rules" correctly in the background.

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

Related articles

By default, the `pageDetail` tag will retrieve data for which single page?

In the powerful functional system of AnQi CMS, flexibly using various tags is the key to improving efficiency for website operators and template developers.Today, let's delve deeply into a tag that is indispensable in building static content pages - `pageDetail`, and focus particularly on the core issue of which single page of data it will retrieve by default. ### Exploring `pageDetail`: How does it intelligently retrieve data?

2025-11-07

Is the `id` parameter of the `pageDetail` tag required?

## AnQiCMS `pageDetail` tag's `id` parameter: Optional flexible art As an experienced website operations expert, I am well aware of the importance of the flexibility of content management system templates in improving operational efficiency and website performance.AnQiCMS (AnQiCMS) boasts its concise and efficient architecture, which is also reflected in the design of template tags.

2025-11-07

How to accurately obtain the details of a single page through the single page ID?

As an experienced website operations expert, I know that how to efficiently and accurately obtain the required data in a content management system is the key to improving operational efficiency.In AnQiCMS (AnQiCMS), a single page (or independent page) is often used to display 'About Us', 'Contact Information', 'Service Introduction', and other important but infrequently changing content.Sometimes, we not only need to display the details on the single page itself, but may also need to reference part of the specific page information on other parts of the website (such as the homepage, sidebar).

2025-11-07

How will the content be directly output if the `variableName` of the `pageDetail` tag is not set?

## Unlock the secrets of Anqi CMS single page content output: The power of the simple `pageDetail` tag As an expert in website operations for many years, I know that efficiently and flexibly displaying content is the key to success in daily content management.AnQiCMS (AnQiCMS) is an enterprise-level content management system developed based on the Go language, and its simple and efficient template engine is very appealing to me.It provides great convenience in content display, especially for single-page content (such as "About Us", "Contact Information", etc.)

2025-11-07

How to use the `token` (URL alias) parameter in the `pageDetail` tag?

AnQiCMS (AnQiCMS) is an efficient and flexible enterprise-level content management system that provides many conveniences in content publishing and SEO optimization.The flexible application of URL alias (`token`) parameters is crucial for enhancing the user experience and SEO-friendliness of the website.Today, let's delve deeper into how to fully utilize the `token` parameter when using the `pageDetail` tag in AnQiCMS templates.

2025-11-07

How to call single page detail data of other sites in a multi-site management environment?

Good, as an experienced website operation expert, I am happy to analyze for you how to efficiently and flexibly call the single page detail data of other sites in the multi-site management environment of AnQiCMS. --- ## Secure CMS Multi-site Management: Easily Handle Cross-site Single Page Detail Data Calls In today's rapidly changing digital world, many businesses and content operations teams face the challenge of managing multiple websites.

2025-11-07

What is the basic syntax structure of the `pageList` tag in AnQiCMS?

## Deeply analyze the basic syntax structure of the `pageList` tag in AnQi CMS Among the powerful functions of AnQi CMS, template tags play a vital role as the bridge connecting backend data with frontend display.For the common single-page content such as 'About Us', 'Contact Us', 'Terms of Service', and others on the website, Anqi CMS provides a simple and efficient tool for management and presentation, that is the `pageList` tag.

2025-11-07

The `pageList` tag defaults to fetching which single page data from the website?

As an experienced website operations expert, I am well aware of the efficiency and flexibility of AnQi CMS in content management.Today, let's delve deeply into an important member of the AnQiCMS template tag system - the `pageList` tag, especially regarding which single page data it will retrieve by default.Understanding this is crucial for us to present content efficiently and design templates. --- ## Deeply analyze the Anq CMS `pageList` tag: What single page data is retrieved by default?

2025-11-07