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.