Optimize SEO and user experience: Anqi CMS helps you easily display the parent category title in the Title

As a senior website operations expert, I know<title><title>The label cleverly integrates the title of the parent category, adding depth to the context of the content, which is a focus for many operators.Today, let's delve deep into how AnQiCMS makes it easy for you to implement this advanced SEO strategy.

Why should the parent category title be displayed in the Title?

Firstly, let's think about why this feature is crucial for website operation.

  1. Enhance SEO Depth and Breadth:
  2. Optimize user navigation experience:
  3. Strengthen website structure signals:The title includes the parent category and is also a way to pass the internal structure and hierarchy of the website to search engines.This helps search engine spiders better crawl and understand the website's topology structure, further consolidating the foundation of the website in terms of SEO.

Elegant solutions for Anqi CMS:tdkTags andshowParentProperty

In AnQi CMS, it is very intuitive and powerful to implement displaying the parent category title in the Title tag, which is due to its flexible template tag system, especiallytdkLabel.

tdkThe tag is a universal tool designed by AnQiCMS specifically for managing page titles (Title), keywords (Keywords), and descriptions (Description).You can use it to dynamically set these elements that are crucial for SEO in the template.tdkThe label named in processing the page title.showParentis a powerful attribute.

This namedshowParentThe attribute, as the name implies, is responsible for controlling whether the parent category name of the current category is displayed in the title. When you set it totrueWhen, AnQiCMS will intelligently trace upwards and present the title of the parent category as well in the final<title>tags.

Specifically within the template code, achieving this effect is very concise, you only need to find in your template file (usually responsible for rendering the page header, including)<head>the basic template for the area, such asbase.html) within,<title>Label it and modify it to the following form:

<title>{% tdk with name="Title" showParent=true %}</title>

This code will instruct AnQiCMS to generate page titles that include not only the title of the current page or category, but also display the titles of its parent categories.AnQiCMS is very intelligent in handling hierarchical relationships, it will automatically build a complete chain containing multiple parent titles based on the actual classification hierarchy of the current page.

It is worth mentioning that,tdkThe label also provides other practical attributes to make your title customization more refined:

  • siteName:If you wish to display the overall name of the website (such as "AnQi CMS") in the title at the same time, you can set it tositeName=true.
  • sep:This attribute allows you to customize the separator between different parts of the title. The default is a hyphen.-You can change it to an underscore according to your brand or SEO needs._|, a vertical line.|Even spaces and so on. For example,sep="_".

So, a complete title tag that displays both the parent category and the website name might look like this:

<title>{% tdk with name="Title" showParent=true siteName=true sep=" | " %}</title>

This may generate titles similar to 'Latest News | Company News | AnQi CMS', which provides rich context and clearly identifies the website's affiliation, greatly enhancing SEO benefits and user experience.

Apply these changes in AnQiCMS template

To actually apply these changes on your website, you need to access the template files of AnQiCMS. According to AnQiCMS design conventions, template files are usually located/templateIn the specific template package under the directory.

  1. Locate the core template file:Most of the time, the websites<title>The tag definitions are in the global basic template, for examplebash.htmlorbase.htmlThese files are usually referenced by other page templates.{% extends %}Tag inheritance.
  2. Edit file:Use the "Template Design" feature provided by the AnQiCMS backend, or directly edit the corresponding files via SFTP and other methods.
  3. Replace the existing title tags:Find<title>Label (it may originally only contain){% tdk with name="Title" %}or other variables), and replace it with the one we discussed, which is the one withshowParent=trueattributestdkLabel.
  4. Save and update the cache:After modifying the template file, please click the "Update Cache" button on the AnQiCMS backend to ensure that your changes take effect immediately.

By following these simple steps, you can utilize the powerful functions of AnQiCMS without performing complex secondary development, thus achieving the display of the parent category title in the Title tag, adding luster to your content operation.


Common Questions and Answers (FAQ)

Q1:showParent=trueDoes it support the display of multi-level parent categories, for example, will article titles, second-level category titles, and first-level category titles all be displayed?

Yes, AnQiCMS supportsshowParent=trueThe property is designed to intelligently trace upwards.When you use this attribute on the article detail page, it will automatically identify and include the titles of all parent categories belonging to the article, up to the top-level category.sepAdjust the properties.

Q2: BesidesshowParentAttribute, would I like to add other custom text to the Title, does AnQiCMS support it?

AnQiCMStdkTags are mainly used to dynamically retrieve the system predefined Title, Keywords, and Description. If you want to add completely customized fixed text outside of these dynamic contents, you may need totdkThe output of the label is concatenated before and after. For example, if you want to add 'Exclusive Report:' before all titles, you can write it like this in the template: <title>独家报道:{% tdk with name="Title" showParent=true %}</title>Please note that excessive or inappropriate custom text may dilute the SEO value of the original title, and should be used with caution.

Q3: If a category does not have a parent category or if the parent category is not set with a title,showParent=truehow will it be displayed?

if a category itself is a top-level category without a parent,showParent=trueWill not forcibly add non-existent parent titles, only the title of the current category will be displayed.Similarly, if the title of a parent category is not set, AnQiCMS will also intelligently skip the item, or trace back to a more superior valid title according to the system logic, ensuring that the final title structure is complete and meaningful, and avoiding blank or erroneous information.The design of AnQiCMS aims to provide a robust content display mechanism.