In website operation, the page title (Title), keywords (Keywords), and description (Description) are the foundation of Search Engine Optimization (SEO).They not only convey the core information of the page content to search engines, but also directly affect the click-through rate of users on the search results page.The AnQiCMS system understands its importance and provides a flexible and powerful mechanism that allows users to dynamically and accurately set these SEO elements according to the content of different pages.

This article will discuss in detail how to efficiently and dynamically manage and set the title, keywords, and description of pages in AnQiCMS.


AnQiCMS 中的核心工具:Universal TDK Tag

AnQiCMS provides an extremely convenient 'Universal' tag for dynamic TDK setting.tdk.The cleverness of this tag lies in its ability to intelligently fetch and output the corresponding title, keywords, and description based on the type of the current page (such as the homepage, article detail page, category list page, or single page).tdkLabel, the system will automatically complete the match.

tdkLabels usually have the following uses, throughnameParameters to specify the specific content you want to obtain:

  • name="Title": Used to get the page's<title>Tag content.
  • name="Keywords": Used to get the page's<meta name="keywords">Content.
  • name="Description": Used to get the page's<meta name="description">Content.
  • name="CanonicalUrl":Used to get the standard link of the page (<link rel="canonical">).

In addition, when you usename="Title"you can also customize the display style of the title further through additional parameters:

  • siteName=trueorsiteName=false:Decide whether to append the website name after the title. Default is not appended.
  • sep="分隔符"Customize the separator between the website name and the page title, default is:-.
  • showParent=trueorshowParent=false:In the category or document page, decide whether to display the title of the parent category. Default isfalse.

Set TDK dynamically: varies by page

AnQiCMS's dynamic TDK settings follow a clear priority rule to ensure that each page has the most accurate SEO information.

1. Home page TDK settings

The homepage acts as the gateway of the website, and the setting of its TDK is particularly crucial.In AnQiCMS backend, you can go to the 'Backend Settings' under 'Home TDK Settings' area to configure exclusive title, keywords, and description for your website homepage.These settings will serve as an important foundation and default fallback for the entire website's TDK.

In the template, you can call the home page TDK in the following ways:

<title>{% tdk with name="Title" siteName=true sep="_" %}</title>
<meta name="keywords" content="{% tdk with name="Keywords" %}">
<meta name="description" content="{% tdk with name="Description" %}">

2. Document detail page (article/product) TDK settings

For specific article or product detail pages, AnQiCMS allows you to perform highly customized TDK settings when publishing or editing documents. Usually, there will be a collapsible area labeled 'Other Parameters' or 'SEO Settings' on the 'Add Document' or 'Edit Document' interface, where you can find:

  • SEO titleThis field will be used directly as the page of the document.<title>The content has a higher priority than the system default and category settings.
  • Document keywordsYou can manually input or select from the keyword library as the page of the document.<meta name="keywords">.
  • Document SummaryIf no independent description is set, the system will prioritize extracting the introduction here as the page content.<meta name="description">If the document summary is also not filled in, the system will automatically extract the first 150 characters from the document content as the description.
  • standard links (Canonical Url):Used to specify the standard URL of the page, which helps to avoid duplicate content issues.

In the template of the document detail page,tdktags will intelligently extract these targeted settings:

<title>{% tdk with name="Title" siteName=true %}</title>
<meta name="keywords" content="{% tdk with name="Keywords" %}">
<meta name="description" content="{% tdk with name="Description" %}">
{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}

You can see,tdkLabels can be automatically identified and prioritized on the document detail page to use the SEO title, keywords, and description that you have individually set up in the background.

3. Classification list page TDK settings

Each category can have its own independent SEO information. When editing a category in the "Document Category

  • SEO titleEnglish for the category list page of<title>.
  • KeywordsEnglish for the category list page of<meta name="keywords">.
  • Category IntroductionIf no independent description is set, the system will prioritize extracting the introduction here as the page content.<meta name="description">.

In the template of the category list page,tdkThe tags will dynamically read the specific settings of these categories:

<title>{% tdk with name="Title" siteName=true showParent=true %}</title>
<meta name="keywords" content="{% tdk with name="Keywords" %}">
<meta name="description" content="{% tdk with name="Description" %}">

Note hereshowParent=trueThe parameter, it can include the title of the parent category in the category title, to build a page title with more levels.

4. TDK settings for a single page

For single pages such as "About Us

  • SEO title
  • Keywords
  • Single page introduction

tdkThe usage of labels in single-page templates is the same as in the document detail page, and it will give priority to reading these page-level settings.

5. TDK settings on the label detail page.

AnQiCMS supports setting independent SEO information for each tag (Tag). When editing a tag in the "Document Tags" management in the backend, you can configure:

  • SEO title
  • Tag keywords
  • Label Introduction

When a user visits the detail page of a tag,tdkthe tag will automatically retrieve and apply these settings.

Complete example: a page header (<head>) TDK code snippet

In your AnQiCMS template file (usuallybase.htmlor the header file of each page), you can place all TDK-related tags in a unified block.<head>区块内。tdkThe intelligent recognition mechanism of tags will ensure that they output the correct content according to the context of the current page:

`twig <!DOCTYPE html>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{# 页面标题,并附加网站名称,使用下划线作为分隔符 #}
<title>{% tdk with name="Title" siteName=true sep="_" %}</title>
{# 页面关键词 #}
<meta name="keywords" content="{% tdk with name="Keywords" %}">
{# 页面描述 #}
<meta name="description" content="{% tdk with name="Description" %}">
{# 规范链接,判断是否存在才输出 #}
{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}

{# 其他头部内容,如CSS、Favicon等 #}
<link rel="stylesheet" href="{% system with name="TemplateUrl" %}/css/style.css">
<link rel="icon" href="/favicon.ico" type="