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

As an experienced website operation expert, I know<title>The core position of tags in website SEO and user experience.A well-crafted title that not only helps search engines better understand the page content and improve keyword rankings, but also provides clear navigation when users browse the search results page and attracts clicks.In a multi-level content structure, how to display on the page's<title>Tag cleverly integrates the parent category title, adding contextual depth to the content, which is a focus for many operators.Today, let's delve deeply into how AnQiCMS (AnQiCMS) allows you to easily implement this advanced SEO strategy.

AnQiCMS is an enterprise-level content management system developed based on the Go language, with its design philosophy always focusing on "efficient, customizable, and easy to expand", especially in terms of SEO optimization, it provides many powerful tools that are ready to use out of the box.It deeply understands the importance of every byte to the performance of the website, therefore, it also provides great flexibility and intelligent support when dealing with details like page titles.

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

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

  1. Enhance SEO depth and breadth:When your website content has a clear hierarchy, such as "News Center > Company News > Latest News", if the title of a single article only displays "Latest News", the search engine may find it difficult to fully understand its broader topic.Including the parent category (such as "Company News") in the title can increase the keyword relevance of the page, strengthen its authority in a specific theme, and also cover a wider range of long-tail keywords, thereby improving the overall search visibility.
  2. Improve user navigation experience:When a user opens multiple tabs in a browser or browses in the search engine results page (SERP), a title that includes parent category information can provide richer context.For example, "AnQiCMS – Latest News – Company News" is more likely to help users quickly locate content, reduce the feeling of being lost, and enhance the professionalism of the website.
  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 to better crawl and understand the website's topology structure, further consolidating the foundation of the website in terms of SEO.

Anqi CMS elegant solution:tdkwith the tag andshowParentproperty

In Anqi CMS, the process of displaying the parent category title in the Title tag is very intuitive and powerful, which is due to its flexible template tag system, especiallytdk.

tdkThe tag is a universal tool designed by AnQiCMS specifically for managing page titles (Title), keywords (Keywords), and descriptions (Description).You can dynamically set these elements that are crucial for SEO in the template.And we will focus on introducing today, istdkThe tag, when processing the page title, is namedshowParenta powerful attribute.

This namedshowParentThe property, 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, presenting the titles of the parent categories as well in the final outcome.<title>in the tags.

Specific to the template code, achieving this effect is very concise, you just need to find in your template file (usually responsible for rendering the page header, containing<head>the basic template of the area, such asbase.html) inside.<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 not only include the title of the current page or category but also retrieve and display the title of the parent category.AnQiCMS is very intelligent in handling hierarchical relationships, it will automatically build a complete chain of multi-level parent titles based on the actual classification level of the current page.

It is worth mentioning,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 "AnqiCMS") at the same time in the title, you can set it tositeName=true.
  • sep:This property allows you to customize the separator between parts of the title. The default is a hyphen.-You can change it to an underscore according to your brand or SEO needs._、vertical line|Even spaces and so on. For example,sep="_".

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

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

This may generate a title like '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 the AnQiCMS template

In order to actually apply these changes on your website, you need to access the AnQiCMS template files. According to the design conventions of AnQiCMS, template files are usually located/templatein the directory of specific template packages.

  1. Locate the core template file:In most cases, websites<title>tags are defined in the global basic templates, for examplebash.htmlorbase.htmlThese files are usually passed through 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 file through SFTP or other methods.
  3. Replace the existing title tag: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=truepropertiestdk.
  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 make full use of the powerful functions of AnQiCMS without any complex secondary development, and display the parent category title in the Title tag, adding luster to your content operation.


Frequently Asked Questions (FAQ)

Q1:showParent=trueDo you 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'showParent=trueThe property is designed to intelligently trace upwards. When you use this property 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.This means that if your classification hierarchy is "first-level category > second-level category > article", then the title may be displayed as "Article Title - Second-level Category Title - First-level Category Title", and the specific level and separator can be specified throughsepAdjust the properties.

Q2: BesidesshowParentProperty, do I want to add other custom text in Title, does AnQiCMS support it?

AnQiCMS'tdkTags are mainly used to dynamically retrieve the system's preset Title, Keywords, and Description. If you want to add completely custom fixed text outside of these dynamic contents, you may need totdkConcatenate the output label 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 the parent category has not set a title,showParent=truehow will it perform?

If a category itself is a top-level category without a parent,showParent=trueWill not forcibly add non-existent parent titles, it will only display the title of the current category.Similarly, if the title of a parent category is not set, AnQiCMS will also intelligently skip this item, or trace back to the effective title of a higher level according to the system logic to ensure that the final title structure is complete and meaningful, and avoid blank or error information.The design of AnQiCMS aims to provide a robust content display mechanism.