How to use the `{% tdk %}` tag in AnQiCMS template to call the home page TDK information?

Calendar 👁️ 67

In the AnQiCMS content management system, the management of TDK (Title, Description, Keywords) information for website SEO is a crucial aspect.AnQi CMS provides convenient and powerful template tags for website operators to flexibly call this information on the frontend page.{% tdk %}Tags are special tags used to handle page TDK information.

{% tdk %}The tag is used to obtain the current page's title (Title), keywords (Keywords), and description (Description) etc. SEO meta information in the AnQiCMS template. The basic usage format in the template is{% tdk 变量名称 with name="字段名称" %}. Among them,变量名称It is an optional parameter, if set, the obtained TDK information can be referred to by the variable name later; if not set, the tag will directly output the field content.

Call home page TDK information

Call for home page TDK information,{% tdk %}Tags provide fine-grained control, allowing operators to flexibly display according to actual needs.

Home Title (Title)

The page title is the first impression of search engines and users to understand the content of the page, and for the homepage, it is the direct embodiment of the brand and core business of the website. In AnQiCMS, you can{% tdk with name="Title" %}Call the home page title.

This tag supports additional parameters to adapt to different display scenarios when calling the title. For example,siteNameParameter (boolean type, default asfalse) Can control whether to append the website name after the title. If set tositeName=true, then the home page title will automatically concatenate the website name to form the format "Home Title - Website Name".

At the same time,sepThe parameter allows you to customize the separator between the title and the website name, the default is a hyphen-. By settingsep="_", you can change the separator to an underscore.

showParentParameter (boolean type, default asfalse) Typically used on detail pages or list pages to control whether the title of the parent category is displayed.But when calling on the homepage, this parameter is usually not applicable because the homepage usually does not have the concept of parent categories.

This is an example of calling the home page title

{# 默认调用首页标题,不显示网站名称后缀 #}
<title>{% tdk with name="Title" %}</title>

{# 调用首页标题并显示网站名称后缀 #}
<title>{% tdk with name="Title" siteName=true %}</title>

{# 调用首页标题并使用自定义分隔符(例如下划线)显示网站名称后缀 #}
<title>{% tdk with name="Title" sep="_" siteName=true %}</title>

{# 通过变量名称获取首页标题 #}
<title>{% tdk seoTitle with name="Title" siteName=true %}{{seoTitle}}</title>

Home page keywords (Keywords)

Keywords are important metadata that help search engines understand the core content of a website. In the AnQiCMS template, the home page keyword information can be accessed through{% tdk with name="Keywords" %}Tags can be easily obtained. These keywords are usually filled in the HTML.<meta name="keywords" content="">in the tag.

Here is an example of calling the home page keywords:

{# 默认调用首页关键词 #}
<meta name="keywords" content="{% tdk with name="Keywords" %}">

{# 通过变量名称获取首页关键词 #}
<meta name="keywords" content="{% tdk seoKeywords with name="Keywords" %}{{seoKeywords}}">

Home page description (Description)

The page description is a brief summary of the website content, which is displayed on the search engine results page and affects the user's click intention. Use{% tdk with name="Description" %}Labels can easily insert the home page description in the template, usually used in HTML's<meta name="description" content="">.

Here is an example of how to call the home page description:

{# 默认调用首页描述 #}
<meta name="description" content="{% tdk with name="Description" %}">

{# 通过变量名称获取首页描述 #}
<meta name="description" content="{% tdk seoDescription with name="Description" %}{{seoDescription}}">

Page's canonical URL (CanonicalUrl)

The canonical URL is an important SEO strategy used to resolve issues with multiple URLs pointing to the same content, informing search engines which version is the 'authoritative' one to avoid duplicate content problems.Although mainly applied to pages with repeated content, it may also need to be specified on the homepage. Through{% tdk with name="CanonicalUrl" %}The tag can call the home page's canonical URL.

Since some pages may not have set a canonical URL, to avoid outputting empty<link rel="canonical">Label, it is recommended to check if it exists before use.

The following is an example of calling the home page specification link:

{# 通过变量名称获取规范链接,并判断其是否存在后输出 #}
{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}

Through the above{% tdk %}Flexible use of tags and related parameters, AnQiCMS website operators can efficiently and accurately manage the TDK information on the homepage, laying a solid foundation for search engine optimization.


Frequently Asked Questions (FAQ)

Ask: How can I set the TDK information of the home page in the AnQiCMS background?Answer: You can log in to the AnQiCMS backend and navigate to the 'Background Settings' menu under the 'Home TDK Settings' page.On this page, you can find the 'Home Title', 'Home Keywords', and 'Home Description' input boxes, enter the corresponding content and save.

Question:{% tdk %}Can tags only be used on the home page? Can I use them to call TDK information on the article detail page?Answer:{% tdk %}The label is not only used on the homepage.It is a universal TDK tag that can be used on any page of the AnQiCMS template.When used on the article detail page, it will call the TDK information set by the article itself; if the article is not set, it will usually fallback to the category's TDK, then to the model's TDK, and finally to the TDK information of the home page.

Why is it recommended to check if the canonical URL exists before calling it?Answer: Not all pages need or have set up a standard link. If it is directly output.link rel="canonical"Tag and itshrefThe property is empty, which may cause the HTML structure to be不规范, and even may be misread by search engines.Therefore, it is good practice to ensure that the tag is only output when the specification link actually exists in the template.

Related articles

How to customize the separator between the website name and the main title in the AnQiCMS homepage title?

As a senior AnQiCMS website operations manager, I fully understand the key role of the homepage title in search engine optimization (SEO) and user experience.A clear and easily recognizable title can effectively convey the core theme of the website and help users quickly understand the content of the webpage, thereby improving click-through rates and retention.AnQiCMS as a flexible content management system provides rich features to meet our refined control requirements for content display, including the customization of the separator between the website name and the main title in the homepage title.###

2025-11-06

Does AnQiCMS support automatically adding the website name after the homepage title? How to enable or disable it?

As a senior security CMS website operation personnel, I fully understand the importance of reasonably integrating the website name into the title for SEO optimization and brand recognition.AnQiCMS is a system focused on efficient content management and naturally provides a flexible way to handle this common requirement. --- ### Does AnQiCMS support automatically adding the website name after the homepage title?How to turn on or off?

2025-11-06

If the homepage TDK is set to empty, how will AnQiCMS handle the page's Title, Keywords, and Description tags?

As an experienced enterprise CMS website operation personnel, I know the importance of TDK (Title, Description, Keywords) settings for website SEO optimization.It is not only the key entry point for search engines to understand web content, but also the first impression that users see in search results.Therefore, how AnQiCMS will handle the situation when the TDK setting on the homepage is empty is a very worthy topic for in-depth discussion.### The importance of the homepage TDK and the configuration entry of AnQiCMS First

2025-11-06

When will the update be visible in the search engine after the TDK settings on AnQiCMS's homepage are set?

As a senior security enterprise CMS website operator, I know that the setting of the homepage TDK (Title, Description, Keywords) is crucial for the performance of the website in search engines.The homepage TDK is not only the "facade" of the website, but also a key signal for search engines to understand and judge the core content of the website.After we modify the TDK of the homepage of AnQiCMS backend, many operators will be eager to know when these updates can be captured and displayed by search engines.This is not a simple fixed time point

2025-11-06

How to specify the `siteName` parameter when retrieving Title using the `{% tdk %}` tag?

As a senior website operations manager of AnQi CMS, I know that every detail of the website may affect user experience and search engine performance.During content creation and publication, the TDK (Title, Description, Keywords) of the page is the foundation of SEO optimization.Today, let's delve into the specific usage and importance of the `{% tdk %}` tag in obtaining page titles in AnQi CMS and the `siteName` parameter.

2025-11-06

How to adjust the `sep` parameter of the `{% tdk %}` tag to change the connection symbol between TDK elements?

As a website operator who is deeply familiar with AnQiCMS, we know that every detail of the website can affect its performance in search engines and the user experience.Among them, TDK (Title, Description, Keywords) is the most critical metadata of the web page, and its setting is particularly important.In AnQiCMS, the `{% tdk %}` tag provides a convenient way to manage these important SEO elements.This article will focus on a practical parameter of this tag - `sep`

2025-11-06

How to get the Keywords or Description of the homepage separately by using the `{{ tdk }}` tag?

As a senior personnel deeply involved in the operation of AnQiCMS (AnQiCMS) website, I am well aware of the importance of TDK (Title, Description, Keywords) for website search engine optimization (SEO), especially for the 'face' of the website - the homepage. The precise setting and effective invocation of TDK is of paramount importance. AnQiCMS provides a powerful and flexible template tag system, among which the `{% tdk %}` tag is a powerful tool for managing page meta-information.

2025-11-06

What are the advantages of AnQiCMS' "Universal TDK Tag" in the home page TDK settings?

As an experienced website operator proficient in AnQiCMS and skilled in content creation, editing, publishing, and optimization, I am well aware of the crucial role that every detail plays in website SEO, especially for the 'face' of the website - the homepage. The setting of the TDK (Title, Description, Keywords) tags is of utmost importance. The 'universal TDK tag' feature provided by AnQiCMS in this field demonstrates excellent advantages in homepage settings, bringing great convenience and efficiency improvement to website operations

2025-11-06