In website operation, page title (Title), keywords (Keywords), and description (Description), which is what we commonly call TDK, is the foundation of search engine optimization.They can not only help search engines understand the content of the page, but are also key factors in attracting users to click.tdkTags make it easy and efficient to dynamically generate and flexibly control page TDK.

How TDK is dynamically generated: the intelligent mechanism of Anqi CMS

Anqi CMS'stdkThe tag design is very intelligent, it can automatically identify and grab the most relevant TDK information according to the type of the current page (such as the homepage, article detail page, category list page, single page, or tag page). This mechanism has a clear priority:

  1. Content level TDK priority:.When you set SEO titles, keywords, and descriptions for specific articles, products, categories, single pages, or tags in the background,tdkThe label will prioritize this information.For example, the 'SEO Title', 'Keywords', and 'Description' filled in on the 'Publish Document' or 'Edit Category' interface.
  2. Home page TDK fallback:If the current page does not have specific TDK settings,tdkthe tags will revert to the content defined in the "Home TDK Settings" under the "Background Settings".

This means that you only need to fill in the content as needed when publishing.tdkTags can automatically display the most appropriate TDK on the front-end, greatly reducing repetitive work and ensuring the fine management of SEO.

tdkThe application of tags in templates

To apply TDK in your security CMS website template, you usually need toheadTag internal usagetdktag to call the corresponding data.

1. Dynamically generate page titles (name="Title")

The page title is the most important element in TDK.tdkTags provide rich flexibility when getting the page title.

Basic usage:

The simplest way to call it in a template is:

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

This simple code allows AnQiCMS to automatically output the most suitable page title based on the context of the current page.For example, on the article detail page, it will display the SEO title of the article; on the category page, it will display the category name; on the homepage, it will display the homepage title.

Flexible control over whether to include the website namesiteName参数):

AnQiCMStdkTags provide a very practicalsiteNameParameter, allowing us to flexibly control whether the page title includes the website name. By default,siteNameYesfalse, means that the title will not automatically append the website name.

  • If you want the website name to be displayed after the page title, simply set the parameter assiteName=trueas follows:

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

    For example, if the article title is “AnQi CMS template making tutorial”, and the website name is “AnQi CMS”, then the output title may be “AnQi CMS template making tutorial - AnQi CMS”.

  • If you do not want the page title to include the website nameor wish to manually control the display position and format of the website name, you can keepsiteName=false(or not write this parameter, as it is the default)false),then manually concatenate according to your needs.

    <title>{% tdk with name="Title" siteName=false %} - 我的自定义网站名</title>
    

    Thus, on specific pages, you can fully customize the display of the website name to ensure consistency with your brand strategy.

Custom delimiter (sep参数):

By default,tdkTags are used when concatenating the title and website name-As a delimiter. If you have different requirements, for example, you want to use_or|, you cansepset the parameter to:

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

So, your title will become “Page Title_website Name”.

Display parent category title (showParent参数):

For some category pages, we may want to reflect their parent category in the title.showParentParameters can bename="Title"effective at that time, when set totrue, the title will include the name of the parent category:

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

2. Dynamically generate page keywords (name="Keywords")

Page keywords (Keywords) may have decreased in weight in modern SEO, but they are still an important part of page information.tdkTags can automatically retrieve keywords set in the background.

<meta name="keywords" content="{% tdk with name="Keywords" %}">

Here are theKeywordsThe content will be prioritized from the "Keywords" field of the current page (article, category, single page, tag), if not set, it will fallback to the "Home Page TDK" keyword.

3. Dynamic generation of page description (name="Description")

页面描述(Description)是搜索引擎结果页(SERP)中显示给用户的摘要,直接影响点击率。

<meta name="description" content="{% tdk with name="Description" %}">

DescriptionThe content will be prioritized from the "Introduction" field of the current page (article, category, single page, tag), if not set, it will fallback to the "Home Description" in the TDK of the homepage.

4. English specification link for dynamically generated pagesname="CanonicalUrl")

The canonical URL (Canonical URL) is crucial for avoiding duplicate content issues, it tells search engines which is the preferred version of the page.tdkTags can also dynamically retrieve this value.

{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}

Here we firstCanonicalUrlAssign the value tocanonicalvariable, then pass it through aifcondition to ensure that only when the specification link exists, the output is displayed.linkLabel, this is a good practice that can avoid outputting emptycanonicalLabel.

**Practice of TDK applications

To maximizetdkThere are several small tips worth sharing about the effect of labels in SEO:

  • TDK's uniqueness:Ensure that the TDK of each important page is unique and highly relevant. Avoid content repetition, even for similar pages, and have subtle differences.
  • Keywords' reasonable layout:Naturally integrate core keywords into the title and description, avoiding堆积。
  • The attractiveness of the description:The page description should be concise and clear, able to attract users to click. It can be regarded as ad copy.
  • Length control:The title is generally recommended to be within 60 characters, and the description within 120-150 characters to ensure complete display on the search engine results page.
  • The habit of setting TDK in the background:When publishing any new content (articles, products, categories, single pages, tags), develop the habit of filling in its SEO title, keywords, and description, so as to make full use oftdkThe dynamic ability of the label, avoid using default values.

By making reasonable use of the CMStdkLabels and their rich parameters, not only can you efficiently manage the TDK information of the website, but you can also provide for the website