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

Calendar 👁️ 51

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 call of TDK is of utmost importance. AnQiCMS provides a powerful and flexible template tag system, among which{% tdk %}Tags are the tools for managing page metadata.

This article will elaborate on how to use AnQiCMS's{% tdk %}Label, accurately obtain and display the Keywords (keywords) and Description (description information) on the homepage.


Accurately obtain the home page Keywords and Description:{% tdk %}Practical application of tags

In website operation, the home page TDK is a key element to convey the core information of the website to search engines and attract target users to click. Anqi CMS is well-versed in this matter, its{% tdk %}The universal tag is born for this. It can intelligently recognize the context of the current page and automatically extract the corresponding TDK information, greatly simplifying the work of template developers.This means that for the homepage, there is no need for additional parameter configuration, as the system can directly retrieve the preset content in the "Homepage TDK Settings" backend.

Invoke Home Page Keywords (Keywords)

The home page keywords are the core vocabulary that inform the search engine of the main content covered by the website. In the Anqi CMS template, to obtain the home page Keywords, we mainly use{% tdk %}Label collaborationname="Keywords"Parameter to achieve.

In particular, you can find the homepage template file in<head>the area, and use the following code structure to output the keywords of the homepage:

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

The purpose of this code is: when the page loads, the Anqi CMS template engine will parse{% tdk with name="Keywords" %}This part of the label. Since the current page is the homepage of the website, the system will automatically go to the background "Homepage TDK Settings" to find the keywords you have configured for the homepage and replace their values.contentProperties are rendered out in the browser ultimately<meta name="keywords" content="您的首页关键词">Such HTML code ensures that search engines can accurately identify and understand the keyword information on your homepage.

Call Home Page Description

The homepage description is a concise summary of the content on the website's homepage, which often appears in the summary part of the search engine results page and directly affects the user's willingness to click. Like keywords, obtaining the homepage description also depends on{% tdk %}Label, but need tonamethe parameter toDescription.

To display the home page description in the home page template file, you can use the following code in the<head>area:

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

This template code's execution logic is the same as when obtaining keywords: Anqi CMS's template engine will recognize and parse{% tdk with name="Description" %}Label, automatically extracts the description content you define for the homepage from the background "Homepage TDK settings" and fills it in<meta name="description" content="您的首页描述">The corresponding position. A clear and attractive homepage description is crucial for improving click-through rate and user experience.

Comprehensive Application: Build a complete homepage TDK structure.

In web development, the Title (title), Keywords, and Description of the homepage are usually present and work closely together. The following is a complete homepage<head>Regional TDK code example, showing how to combine them organically:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <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" %}">
    <!-- 其他Meta信息和CSS链接 -->
</head>
<body>
    <!-- 网站内容 -->
</body>
</html>

In this example,{% tdk with name="Title" siteName=true sep=" - " %}The tag not only gets the homepage title, but also throughsiteName=trueAutomatically adds the website name as a suffix, and usessep=" - "specified the delimiter andKeywordsandDescriptionas mentioned above, directly obtain and output the corresponding content.

Important tips for operators

As a website operator, you should always remember,{% tdk %}The strength of the tag lies in its direct mapping to the TDK settings of the Anqie CMS backend.Therefore, it is crucial to fill in high-quality, relevant, and SEO-compliant titles, keywords, and descriptions in the "Home TDK Settings" in the background.If these backend settings are empty, although the front-end tags will render, butcontentThe attribute will be empty, unable to play its SEO role.

In this way, the Anqi CMS's{% tdk %}The tag provides a centralized, efficient, and easy-to-manage solution, allowing you to easily configure and call key SEO meta information for the homepage, thereby optimizing search engine performance and attracting more potential users.


Frequently Asked Questions (FAQ)

1. I have already configured the keywords and descriptions in the "Home Page TDK Settings" on the backend, why is the home page not displaying?First, please check if your homepage template file has used{% tdk with name="Keywords" %}and{% tdk with name="Description" %}tags correctly, and make sure they are located in<head>Within the area. Next, check the browser cache, as sometimes front-end updates require clearing the cache to see the latest effects.If the problem still exists, please confirm that the template file is the one currently being used by the website and that there is no other custom code overriding these meta tags.

2.{% tdk %}Can tags other than the homepage TDK be used on other pages?Of course you can.{% tdk %}The tag is a 'universal' tag, it will automatically retrieve the corresponding TDK information based on the type of the current page (such as article detail page, category list page, single page, etc.).On these pages, it will try to extract the SEO title, keywords, and description of the article or category.This means you have been on the entire website<head>This area can use this set of tags without needing to write different TDK retrieval logic for different page types, greatly improving the reusability of the template.

3. If my website has not set the home page TDK,{% tdk %}What will the label output?If the corresponding field in the background "home page TDK settings" is left blank, then,{% tdk %}the tag will take these fields when getting them, itscontentThe property will be empty. For example, if the home page keyword is not set,{% tdk with name="Keywords" %}an emptycontentproperty, namely,<meta name="keywords" content="">. This is not usually an ideal SEO practice, it is recommended to provide complete TDK information for the homepage.

Related articles

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 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 use the `{% tdk %}` tag in AnQiCMS template to call the home page TDK information?

In the AnQiCMS content management system, the management of TDK (Title, Description, Keywords) information for website SEO is a crucial link.AnQi CMS provides convenient and powerful template tags for website operators, allowing flexible calls to this information on the front-end page.Among them, the `{{ tdk }}` tag is a universal tag specifically used to handle page TDK information.

2025-11-06

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

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

How to set and manage TDK for other pages in AnQiCMS except for the homepage?

As an experienced CMS website operation person, I know that the setting and management of TDK (Title, Description, Keywords) on other pages of the website, except for the homepage, is crucial for improving search engine rankings and user experience.The Anqi CMS provides flexible and powerful tools to ensure that every page of the website has precise optimized TDK information.

2025-11-06

How to set an independent SEO title for a single article when publishing an article (archive)?

As an operator who has been dealing with AnQiCMS for a long time, I know the importance of content in attracting and retaining users, and I am also aware of the decisive role of search engine optimization (SEO) in content dissemination.AnQiCMS was designed with SEO needs in mind from the outset, providing many practical tools.

2025-11-06

Does the 'Document Summary' of the article automatically fill in the page's Description, and what is the character limit?

As an experienced person deeply familiar with the operation mechanism and content operation strategy of AnQiCMS (AnQiCMS), I fully understand your attention to the details of content display, especially the key role of page metadata in search engine optimization.The association between the 'Document Summary' field and the page's Description tag, as well as the character limit, is an important aspect that must be clarified before content is published.

2025-11-06