How to generate a permanent link for documents in AnQiCMS template: A comprehensive guide from backend configuration to frontend presentation

In the operation of the website, a clear, easy-to-understand, and search engine-friendly permanent link (Permalink) is self-evident in value.It not only enhances user experience, allowing visitors to recognize the page content at a glance, but is also the foundation of website SEO optimization.An URL structure that is stable and semantically meaningful, which can effectively help search engines crawl and understand your content, thereby influencing the ranking performance of the website.AnQiCMS knows this, therefore, it provides users with high flexibility and automation capabilities in generating and managing permanent links.

As an experienced website operations expert, I will guide you to deeply understand how AnQiCMS is configured from the backend to the frontend template presentation, step by step building your permanent link system for documents.

1. English backend static rules: lay the foundation for links

The final form of permanent link, which is first determined by the pseudo-static rules of the website.The pseudo-static technology can rewrite dynamically generated URLs into a static form, which retains the flexibility of dynamic content while also obtaining the friendliness of static URLs to search engines.

AnQiCMS provides a variety of predefined rewrite rules for users, such as 'numeric mode' (using content ID as the URL identifier), 'model naming mode' (using the model the content belongs to as the identifier), and 'category naming mode' (using the category the content belongs to as the identifier).These patterns can meet the basic needs of most websites.

However, for users who pursue the ultimate SEO optimization or have special business needs, 'Custom Mode' is undoubtedly a powerful tool.In Custom Mode, you can freely combine various built-in variables to design a unique URL structure, just like building with blocks.

  • {id}: Document, category, or single page unique digital ID. This is the most stable and direct identifier.
  • {filename}: English document or single-page custom link name, usually specified by the user during content editing.
  • {catname}: Custom link name for categories, defined by the user in category management.
  • {module}: English of the URL alias belonging to the content model, for example, the article model may have an alias likearticle, the product model may have an alias likeproduct.
  • {page}: It is used to indicate the page number when pagination exists on the list page.

Through the flexible combination of these variables, you can achieve such as/article/anqi-cms-template.html//news/category/industry-updates.htmlEven more complex URL structures.The pseudo-static rule management interface of AnQiCMS is intuitive and easy to use, allowing you to easily adjust and preview the URL effects without touching any code.Plan your URL rewriting rules reasonably, which is the first step to build efficient and permanent links.

2. Content editing feature 'Custom URL': Assigns personal identifiers to content

It may not be possible to meet all individualized needs solely relying on the global pseudo-static rules.AnQiCMS provides a 'Custom URL' feature on the content editing level, allowing each content unit to have a unique link with more descriptive or brand characteristics.

Whether it is publishing articles, creating categories, or editing independent pages or tags, you can find an input box named "Custom URL" in the corresponding management interface. This field allows you to specify a unique identifier that is easy to remember and spread for specific content units, which is usually related to the pseudo-static rules you use.{filename}or{catname}The variable corresponds to.

For example, if you have an article about "AnQiCMS template development tips", the system may automatically generate a custom URL for it.anqicms-moban-kaifa-jiqiao。If you want to optimize it to be more concise and keyword-rich,anqicms-template-devIt can be manually modified by doing this.It is worth noting that the custom URL must ensure uniqueness throughout the entire site to avoid link conflicts, and if the manually entered value is duplicated, the system will append random numbers to ensure its uniqueness.

By carefully setting up a custom URL, you can make each piece of content have a permanent link that conforms to the overall rules while also being personalized and SEO-friendly.

3. English translation: Call in template: Easily display permanent links

Once the pseudo-static rules and custom URL settings of the background are properly set up, it becomes very intuitive and simple to call and display these permanent links in the AnQiCMS template, without the need for complex URL concatenation or dynamic parsing.

AnQiCMS all content tags (such asarchiveListto get the document list,archiveDetailto get the document details,categoryListto get the category list,pageListto get the single page list,tagDetailUsed to get tag details, as well asnavListUsed to get navigation lists, etc.) will provide a named field directly in the returned data structure.Linkfield. ThisLinkThe field already contains the complete, accessible permanent link generated according to the pseudo-static rules and content custom URL configured on your backend.

This means, you just need to simply refer to this in the templateLinkfield, for example:

  • When outputting the article list in a loop, the permanent link of each article can be presented by{{ item.Link }}.
  • When displaying the detail page of the current article, the permanent link of the article itself can be accessed through{% archiveDetail with name="Link" %}to get.
  • The same logic applies to the links on category, single page, or tag pages, you just need to call its corresponding tag in the respective tagLinkfield.
{# 示例:在文章列表中调用每篇文章的永久链接 #}
{% archiveList archives with type="list" limit="10" %}
    {% for item in archives %}
        <li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
    {% endfor %}
{% endarchiveList %}

{# 示例:在文章详情页调用当前文章的永久链接 #}
<link rel="canonical" href="{% archiveDetail with name="Link" %}" />

This design greatly simplifies the work of template developers, encapsulating the complex logic of URL generation in the system's underlying layer, allowing the front end to focus only on content presentation, ensuring the correctness and consistency of URL output.

Summary: Flexible and efficient link management coexists

In summary, AnQiCMS combines flexible pseudo-static rule configuration in the backend with custom URL editing on the frontend to build an efficient, easy-to-use, and SEO-friendly permanent link management system.Whether it is a site administrator or a template developer, both can easily manage and present URLs with good user experience and search engine performance within their respective areas of responsibility.With the powerful 301 redirect management function of AnQiCMS, even if the URL structure has to be adjusted due to business development, it can effectively avoid dead links and ensure that the SEO assets of the website are not lost.This comprehensive and detailed consideration is exactly the value of AnQiCMS as an experienced content management system.


Common Questions (FAQ)

  1. Q: Will the old document links become invalid immediately after changing the pseudo-static rules in the background? Do I need to update them manually? A:The strength of AnQiCMS lies in its built-in 301 redirect management.When you change the rewrite rules in the background, the system usually handles the redirection of old links automatically, ensuring that users accessing the old URL can be smoothly redirected to the new URL, thereby avoiding link failure and SEO weight loss.But to ensure it is foolproof, after the rules are adjusted, you can check and add manually as necessary through the "301 Redirect Management" in AnQiCMS's "Function Management" to cover possible special cases.

  2. Q: “Custom URL” field is required? What if I leave it blank? A:The “Custom URL” field is not a mandatory requirement.If you leave it blank, AnQiCMS will automatically generate a link identifier according to the pseudo-static rules you configure in the background, combined with the title of the content (through pinyin conversion, etc.).{filename}Variables, the system will automatically generate a pinyin version of the filename.Although the system automatically generates sufficient intelligence, manually optimizing this field can make it more semantically meaningful and keyword-relevant, which is more beneficial for SEO.

  3. Q: Can I manually concatenate the URL in the template, such as?/article/{{item.Id}}.htmlIs it okay to use and?{{ item.Link }}What is the difference? A:Theoretically, you can manually concatenate, but it is strongly recommended not to do so.Directly concatenating URLs will lose the flexibility of AnQiCMS pseudo-static rules and the advantages of centralized management on the backend.