How to dynamically display SEO title, keywords, and description (TDK) in the page header?

Calendar 👁️ 91

In website operation, the dynamic display of the SEO title (Title), keywords (Keywords), and description (Description) at the page header, abbreviated as TDK, is a core element of search engine optimization (SEO).They can not only help search engines understand the page content, but are also the key to attracting users to click.For users of AnQiCMS, the system provides a powerful and flexible mechanism to implement TDK dynamic management, ensuring that each page can achieve excellent SEO performance.

The importance of TDK and the intelligent support of AnQiCMS

Search engines use TDK as the primary signal to identify the theme of your page when crawling and indexing your website.A well-optimized title can directly affect the click-through rate of users in search results; appropriate keywords can enable your content to be precisely discovered by potential users; and an attractive description can further encourage users to visit.

AnQiCMS knows the value of TDK for SEO, therefore it designed a highly intelligent 'Universal TDK Tag'.This tag does not require you to manually judge the type of the current page (whether it is the homepage, article detail page, category page, or single page), it can automatically identify and extract TDK information from the corresponding backend settings, greatly simplifying the development and maintenance work at the template level.

How to set TDK in the AnQiCMS background?

AnQiCMS provides a refined TDK setting entry for different types of pages, ensuring that you can optimize accurately according to the characteristics of the content.

  1. Homepage TDK settings:The TDK on the homepage usually represents the core theme and brand positioning of the entire website.In AnQiCMS background, you can uniformly configure the title, keywords, and description of the website homepage in "Background Settings" -> "Homepage TDK Settings".This information will serve as the "front page" of your website, affecting the overall SEO weight.

  2. Article, Product Detail Page TDK:Each independent content (such as an article or product) should have a unique TDK.When editing articles or products, you can usually find fields such as 'SEO Title', 'Keywords', and 'Document Summary' in the 'Other Parameters' section of the editing interface.Suggest that you fill out this information for each content.If you do not fill in the 'SEO title' or 'document summary', the system will intelligently use the 'document title' and automatically extracted 'document summary' as the default value.

  3. Category Page TDK:The category page of the website also carries important SEO value.In the "Content Management" -> "Document Category" editor, in the "Other Parameters" section, you can set the "SEO Title", "Keywords", and "Category Description" for the category.These settings will be applied to all list pages that belong to this category.

  4. Single Page TDK:like "About UsIn the 'Page Resources' -> 'Page Management', when editing a single page, you can find fields such as 'SEO Title', 'Keywords', and 'Single Page Description' to configure.

  5. Tag Page TDK:AnQiCMS also supports setting independent TDK for content tags.When editing a tag in "Content Management" -> "Document Tags", you can also configure the "SEO Title", "Tag Keywords", and "Tag Description" in its settings.

Dynamic Display of TDK in Template:

AnQiCMS universal TDK tag (tdk) Is the core for dynamic display. It intelligently selects the most appropriate TDK content based on the context of the current page. Usually, you only need to place it in the website template's<head>Place the following code snippet in the area to enable dynamic management of the entire site TDK:

<!DOCTYPE html>
<html lang="{% system with name='Language' %}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {# 动态显示页面标题 #}
    <title>{% tdk with name="Title" siteName=true %}</title>
    {# 动态显示页面关键词 #}
    <meta name="keywords" content="{% tdk with name="Keywords" %}">
    {# 动态显示页面描述 #}
    <meta name="description" content="{% tdk with name="Description" %}">

    {# 可选:显示规范链接,有利于SEO #}
    {%- tdk canonical with name="CanonicalUrl" %}
    {%- if canonical %}
    <link rel="canonical" href="{{canonical}}" />
    {%- endif %}

    {# 可选:多语言网站的hreflang标签,帮助搜索引擎理解多语言版本 #}
    {%- languages websites %}
    {%- for item in websites %}
    <link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
    {%- endfor %}
    {%- endlanguages %}

    {# 其他页面头部内容,如CSS链接、Favicon等 #}
    <link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">
</head>
<body>
    <!-- 页面主体内容 -->
</body>
</html>

This code is usually placed in your template's public file, for example:bash.htmlorheader.htmlThis ensures that all pages inherit and display the TDK information correctly.

Code analysis:

  • <title>{% tdk with name="Title" siteName=true %}</title>:tdkThe tag automatically retrieves the SEO title of the current page.siteName=trueThe parameter indicates that the website name is appended to the title, for example, "Article Title - Your Website Name", which helps to enhance brand exposure.
  • <meta name="keywords" content="{% tdk with name="Keywords" %}">Get the SEO keywords of the current page.
  • <meta name="description" content="{% tdk with name="Description" %}">Get the SEO description of the current page.
  • {% tdk with name="CanonicalUrl" %}If the page has set a specification link, this tag will be output. The specification link is crucial for avoiding duplicate content and integrating page authority.
  • {% system with name='Language' %}: Obtain the current site's language code from the system settings, used for HTML'slangattribute to enhance the page's accessibility and international SEO.
  • {% languages websites %}This tag is used for multilingual sites, it lists all language versions of the website links, and generateshreflangtag indicating that the search engine has other language or regional versions of this page.

Some considerations in practice

  • Priority of TDK:AnQiCMS's TDK tags follow the priority principle: The SEO settings of specific pages (such as the custom SEO title of article detail pages) take precedence over the settings of their respective categories, and the category settings take precedence over the global homepage TDK settings.This hierarchical relationship allows you to perform fine-grained SEO control.
  • Title separator: tdkThe tag also supports passing throughsepSeparator for custom parameter title, for example{% tdk with name="Title" siteName=true sep=" | " %}.
  • Go language time format:In the template, all operations involving time formatting, such as{{stampToDate(item.CreatedTime, "2006-01-02")}}, must follow the specific date format of the Go language, namely using2006年01月02日15时04分05秒as the reference template.

AnQiCMS through its intelligent TDK tags and flexible backend configuration greatly simplifies the SEO optimization work of the website.By the above introduction, you can easily implement the dynamic display of TDK, in order to win better visibility for your website in search engines.


Frequently Asked Questions (FAQ)

  1. How will AnQiCMS handle it if the SEO title, keywords, and description of a page are not filled in?If the SEO title, keywords, or description of a specific page is not manually filled in, AnQiCMS will try to obtain it according to certain fallback logic.For example, the article detail page will try to use the title of the article itself and the automatically generated summary; the category page may use the category name and category introduction.For the homepage, if not set, it may display default information such as the website name.Although the system has a default processing mechanism, we strongly recommend that you manually fill in the TDK for each important page for **SEO effects.

  2. tdkin the labelsiteName=trueWhat is its function? Will it affect the SEO title I fill in manually? siteName=trueThe parameter is used to automatically append the website name (from the "Global Settings") to the TDK title on the current page.For example, if the SEO title of your article is "AnQiCMS Quick Start", and the website name is "AnQiCMS Official Website", the final displayed title may be "AnQiCMS Quick Start - AnQiCMS Official Website".This parameter will not affect the SEO title content you manually fill in, it is just appended at the end, which helps to enhance brand visibility and recognition.

  3. **excepttdkUniversal tag, I

Related articles

How to display the website name, Logo, filing number, and copyright information in AnQiCMS templates?

AnQiCMS provides an intuitive and powerful template system that allows us to flexibly display various core information on the website.Whether it is the name of the website, Logo, filing number, or copyright statement, these are all key elements that constitute the brand image of the website, meet compliance requirements, and enhance user trust.This article will delve into how to call and display this information in the AnQiCMS template, ensuring that your website content is complete and professional.

2025-11-08

How to obtain and display the website's friend link list in the template?

Managing and displaying friendship links in AnQiCMS is a very practical feature, whether it is to increase the external links of the website, improve SEO effects, or to facilitate users to access partner websites, it can play an important role.AnQiCMS provides a simple and efficient way for us to easily obtain and display these links in the template.### Step 1: Background Management and Configuration of Friend Links Before displaying the friend links on the website front-end, we need to add and manage them in the AnQiCMS background system

2025-11-08

How to get and display the title, content, link, and thumbnail of a specified single page (such as “About Us”)?

In AnQi CMS, the single-page content of a website such as "About UsThese pages not only need to be displayed under independent URLs, but may also need to extract their titles, summaries, links, or thumbnails in other areas of the website (such as the footer, sidebar, or specific modules on the homepage) for display.Anqi CMS provides simple and powerful template tags, allowing you to easily achieve this requirement in website templates.

2025-11-08

How to display a category-specific Banner image or thumbnail on the category page?

In website operation, designing unique visual elements for different category pages, such as a prominent banner image or a dedicated thumbnail, is an effective means to enhance user experience, strengthen brand image, and promote content conversion.AnQi CMS provides intuitive and powerful functional support to meet this requirement.How does Anqi CMS support category-specific visual content?

2025-11-08

How to display the current page's canonical URL in the template to optimize SEO?

In website operations, Search Engine Optimization (SEO) is one of the core tasks to enhance website visibility.Among them, the setting and correct display of the canonical URL (Canonical URL) is crucial for avoiding content duplication, optimizing crawling efficiency, and concentrating page weight.AnQiCMS (AnQiCMS) is a highly SEO-focused enterprise-level content management system that provides users with convenient tools for managing and deploying standardized links.What is a Canonical URL?

2025-11-08

How to enable Markdown editor rendering content on the front-end page and display mathematical formulas and flowcharts?

Content operation plays a crucial role in the digital age today.The strength of a Content Management System (CMS) largely depends on its ability to flexibly support a variety of content presentation forms.AnQiCMS (AnQiCMS) leverages its efficient and flexible features to provide a vast space for content creators.Today, we will delve into how to elegantly enable Markdown editor to create content on the Anqi CMS front-end page, and further realize the rendering of mathematical formulas and flowcharts, making your website content more expressive.###

2025-11-08

How to implement the switching display of multilingual website content and adapt to users of different languages?

Today, with the deepening of globalization, a website that supports multilingualism has become a basic requirement for enterprises to expand into international markets and serve global users.AnQiCMS deeply insight into this trend, providing users with a highly efficient and flexible multilingual website content management solution, helping your website easily switch between different language content display and better adapt to users around the world.The core concept of AnQiCMS implementing multi-language website content switching is based on multi-site management.

2025-11-08

How to dynamically display different group Banner slideshows on the website homepage?

The banner carousel on the homepage is an important window to attract visitors' attention and convey core information.By cleverly setting up, we can allow the home page banner slideshow to dynamically display according to different marketing goals or content themes, which can not only improve user experience but also effectively guide users to browse.AnQiCMS (AnQiCMS) offers flexible features to help users easily meet this requirement.Understanding the Banner mechanism of AnQi CMS In AnQi CMS, the management and display of banners have a clear logic

2025-11-08