In the practice of website operation and Search Engine Optimization (SEO), page metadata (meta data) plays a vital role. Among them, the page title (title), keywords (keywords) and descriptions (descriptionIt directly affects the display effect of the website in the search engine results page and the willingness of users to click. AnQiCMS (AnQiCMS) understands its importance and provides a powerful and flexibletdkTags, help us dynamically and efficiently manage these key metadata.
tdkThe core role of tags: intelligent adaptation of page metadata.
Of Security CMStdkTags are a universal and powerful tool that can automatically capture and output the corresponding title, keywords, and description based on the current page type and backend configuration. This means that no matter which page the user visits, whether it is the homepage of a website, a detailed page of an article, a category list page, or a single page,...tdkTags can intelligently present the metadata that best fits the content of the page, without the need to manually write complex logic for each page.
一般情况下,we would use the template file<head>area.tdkLabel to configure this information.
<head>
<meta charset="UTF-8">
<title>{% tdk with name="Title" %}</title>
<meta name="keywords" content="{% tdk with name="Keywords" %}">
<meta name="description" content="{% tdk with name="Description" %}">
<!-- 其他页面元数据 -->
</head>
Next, we will learn in detail.tdkThe various functions of the label and its flexibility in practical applications.
Detailed analysistdkThe various functions of the label
tdkTag throughnameTo specify the specific metadata type to be retrieved, and provides additional parameters to finely control the output.
1. Dynamically set the page title (Title)
The page title is the most direct signal for search engines to understand the content of the page, and it is also the first information that users see in the search results.tdkTags provide great flexibility when setting page titles:
- Basic usage:The simplest way is to directly output the title of the current page.
At this moment, it will automatically extract the title configured in the background according to the type of the current page (home page, article, category, etc.).<title>{% tdk with name="Title" %}</title> - Attach website name:To maintain brand consistency, we usually want to add the website name after each page title. By setting
siteName=trueyou can achieve it.
For example, if the page title is “AnQi CMS Tutorial”, and the website name is “AnQi CMS”, then the final displayed title may be “AnQi CMS Tutorial - AnQi CMS”.<title>{% tdk with name="Title" siteName=true %}</title> - Custom separator:By default, the website name and page title are separated by a hyphen
-Separator. If you need to use a custom separator, you can usesepParameter.
This title may be changed to "AnQi CMS Tutorial | AnQi CMS".<title>{% tdk with name="Title" siteName=true sep=" | " %}</title> - Display parent category title:In some deeply nested category pages or article detail pages, we may want the title to reflect the hierarchy of the parent category
showParent=trueThe parameter can help us achieve this.
For example, if an article belongs to the "SEO Optimization" category under the "Keyword Research" subcategory, the title may be displayed as "Article Title - Keyword Research - SEO Optimization - AnQi CMS".<title>{% tdk with name="Title" siteName=true showParent=true %}</title>
2. Define the page keywords (Keywords)
The weight of keywords in modern SEO may not be as strong as before, but it is still a way to provide search engines with page topic information.The AnQi CMS allows separate keyword settings for the homepage, articles, categories, and single pages in the background.
- Basic usage:By
name="Keywords"and output the keyword list corresponding to the current page.
These keywords are usually extracted from the "document keywords" or "category keywords" fields of various content types in the background.<meta name="keywords" content="{% tdk with name="Keywords" %}">
3. Optimize page description (Description)
The page description is a brief summary of the page content, which is directly presented below the search result title and is the key copy to attract users to click.A captivating description can effectively improve click-through rate.
- Basic usage:Use
name="Description"Output the description of the current page.
The page description usually comes from the "document introduction", "category introduction", or "single page introduction" fields of various content types in the background.<meta name="description" content="{% tdk with name="Description" %}">
4. Processing specification link (CanonicalUrl)
The canonical URL is used to inform search engines which is the preferred version of the page, to avoid SEO issues caused by duplicate content, especially in cases where multiple URLs point to the same content.
- Basic usage:By
name="CanonicalUrl"Output the specification link of the current page.<link rel="canonical" href="{% tdk with name="CanonicalUrl" %}" /> - Use safely:The standard link is not required or set on all pages. In the template, we should always first check if it exists before rendering to avoid outputting empty.
hrefProperty.{%- tdk canonical with name="CanonicalUrl" %} {%- if canonical %} <link rel="canonical" href="{{canonical}}" /> {%- endif %}
tdkThe label's performance across different page types
tdkThe strength of the label lies in its ability to automatically adapt to different page contexts:
- Homepage of the website:Metadata comes from the "background settings" -> "Home TDK settings" where the title, keywords, and description are configured.
- Article detail page:Metadata is preferred to be extracted from the "SEO title", "document keywords", and "document description" fields of the current article.If these fields are empty, the system may try to generate from the article title, content summary.
- Category list page:Metadata is preferably extracted from the 'SEO Title', 'Keywords', and 'Category Description' fields of the current category.
- Single page:Metadata is prioritized from the "SEO title", "keywords", and "single page introduction" fields of the current page.
This dynamic acquisition mechanism greatly reduces the workload of content operation personnel, while ensuring that each page's metadata is properly managed.
**Practice and Content Operation Strategy
Just understandtdkThe method of using tags is not enough, it needs to be combined with effective content operation strategies to maximize its value:
- Content is king, TDK is the cherry on top:No matter how metadata is optimized, high-quality, valuable page content is always the foundation for attracting users and search engines. TDK tags are just to help content be better discovered and understood.
- Keywords should be naturally integrated, avoid stacking:When writing page titles, descriptions, and keywords, it is important to strive for natural flow and avoid repetition of keywords (keyword stuffing), as this may be viewed as cheating by search engines.
- Describe something attractive, summarize the core of the page:The page description is the content summary that users see in search results, it should accurately summarize the page content, include a call to action or unique selling point, and attract users to click.
- Personalization and Differentiation:For different types of pages (home page, article, category), the TDK settings should be emphasized.For example, the home page TDK should focus on the brand and core business, and the article TDK should revolve around the article theme and long-tail keywords.
- Regular inspection and optimization:After the website goes live, it is not a one-time task. It should be monitored regularly through traffic statistics, search engine site master tools, etc., to adjust and optimize based on data feedback.
By flexibly using AnQi CMS'stdkLabels, combined with refined content operation strategies, we can significantly improve the search engine visibility of the website, attract more target users, and thus achieve better operational results.
Frequently Asked Questions (FAQ)
Q1: I set the page TDK information in the background, but the front-end page did not display. What could be the reason?A1: There could be several reasons:
* **标签未正确放置或拼写错误:** 确保 `tdk` 标签被正确地放置在HTML的 `<head>` 区域,并且 `name` 属性(例如 `name="Title"`)没有拼写错误。
* **后台数据未保存:** 检查您是否在安企CMS后台相应内容的TDK字段中输入了信息并成功保存。
* **缓存问题:** 清理安企CMS的系统缓存