How to dynamically display SEO titles, keywords, and descriptions (TDK) on different pages?

Calendar 👁️ 58

In website operation, Search Engine Optimization (SEO) is a key link to enhance website visibility.Among them, the page title (Title), keywords (Keywords), and description (Description), known as TDK, play a crucial role.They are not only the primary information for search engines to understand the content of the page, but also an important factor to attract users to click.In AnQiCMS (AnQiCMS), we can easily implement the dynamic display of TDK, allowing each page of the website to have relevant and attractive TDK information.

The AnQi CMS took SEO needs into full consideration from the beginning, therefore, it provides a flexible and intelligent TDK management mechanism.The core concept is: by setting the default TDK globally on the website and then allowing personalized settings on more specific page types (such as articles, categories, single pages, and tag pages), the dynamic adaptation of TDK is achieved.This ensures that even if a page does not have a separate TDK set, it can still have a reasonable default value, while also allowing important pages to have precise optimization of TDK.

To implement the dynamic display of TDK, we mainly use a powerful tag in the Anqi CMS template -tdkThe tag is designed to intelligently judge the type of the current page and the TDK information configured, and automatically output the most suitable TDK for the current page.This means that you just need to place in the public header file of the website template (such asbash.htmlorheader.htmlConfigure once in the}tdkLabels, no need to write TDK logic for each page individually, greatly simplifies the maintenance of templates.

Integrated in the templatetdkTag

Generally, TDK information is located in the HTML document.<head>Area. Below is an example of the TDK core code that you can add to the template file/template/您的模板目录/partial/header.html)Add the TDK core code:

<head>
    <meta charset="UTF-8">
    <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" %}">
    {%- tdk canonical with name="CanonicalUrl" %}
    {%- if canonical %}
    <link rel="canonical" href="{{canonical}}" />
    {%- endif %}
    {# 其他头部元素,如样式表、Favicon 等 #}
</head>

This code is the foundation of dynamic TDK. Let's delve deepertdkHow do tags work intelligently on different pages.

TDK configuration on the homepage

For the website's home page TDK, AnQi CMS provides a dedicated backend setting entry.You can directly fill in the title, keywords, and description of the homepage in the "Homepage TDK Settings" in the background.When the user visits the homepage of the website, the template mentioned above includestdkTags will automatically extract and display this preset homepage information.

TDK for articles and product detail pages.

In content management, whether it is publishing articles or products, Anqi CMS provides detailed SEO setting options for each piece of content.When editing articles or products, you can find fields such as "SEO Title", "Document Keywords", and "Document Description".

  • SEO title: If you enter content here,tdkthe tag will be used first as the page<title>. If left blank, it will intelligently backtrack to the title of the article itself.siteName=trueThe parameter ensures that your website name is automatically appended to the title, enhancing brand recognition. You can alsosepcustom separator parameters, for examplesep=" | ".
  • Document keyword: The keywords entered here will be directly used on the page.<meta name="keywords">.
  • Document Introduction: The document summary content will be automatically filled in the page.<meta name="description">tag. If not filled, the system will try to automatically extract the first 150 characters from the article text.

This layered setting method ensures that each piece of content has highly relevant TDK.

TDK of the category list page.

For the article or product category list page, you can set independent TDK for each category in the background "Document Category" management.In the category editing interface, the same fields such as 'SEO title', 'keywords', and 'category description' are provided.

  • SEO titleIf a SEO title is set for the category, it will become the title of the category list page. If it is empty, the category name will be used as the title, and the website name can be appended.
  • KeywordsThis is used as the keywords Meta tag for the category list page.
  • Category introductionThis is the description Meta tag content for the category list page.

Such, different content categories pages can also have their own exclusive SEO optimization.

Single-page TDK

Similar to independent single pages such as "About Us", "Contact Information", etc., their TDK management method is similar to that of article detail pages.When editing a single page in the "Page Management", you can set the "SEO Title", "Keywords", and "Single Page Description" for each page.tdkTags will call this information accordingly.

TDK of tag detail page

The Anqi CMS also supports setting TDK for 'Tags' (Tag) in the website.In the 'Document Tags' management, you can edit the 'SEO Title', 'Tag Keywords', and 'Tag Description' for each tag.When the user visits the detail page of a specific tag,tdkThe tag will dynamically load the TDK information corresponding to the tag.

Application of the specification link (Canonical URL)

In SEO, the canonical URL is used to tell search engines which is the preferred version of the page, to avoid SEO issues caused by duplicate content. Anqi CMS'stdkTags also support dynamic output of specification links. The 'specification link' field entered in the article or category settings, will be{% tdk with name="CanonicalUrl" %}Label output. It is worth noting that this code is usually wrapped in a conditional judgment to ensure that it only outputs when the page indeed has a standard link, thus avoiding the output of an empty label.

Summary

AnQi CMS through a unifiedtdkLabel and multi-level backend configuration make the implementation of dynamic TDK extremely simple and efficient.From global default to page customization, to intelligent rollback, every link is aimed at providing **SEO support for the website.This means that website operators can focus more on content creation and overall strategy, without spending too much energy on the cumbersome configuration of TDK, thereby enabling the website to perform better in search engines.


Frequently Asked Questions (FAQ)

1. If I do not set TDK separately on the article or category page, how will AnQi CMS handle it?

AnQi CMS has an intelligent rollback mechanism. If the page (such as articles, categories, single pages, tag pages) does not set an independent SEO title, keywords, or description, the system will automatically obtain and fill in according to a certain priority.For example, if the article does not have an SEO title set, it will use the title of the article itself;If no document summary is set, the first 150 characters will be automatically extracted from the article content.Finally, if all page-level settings are missing, it will also fallback to the website global default TDK that you have configured in the background "Home TDK Settings", ensuring that each page has basic TDK information.

2.tdklabel'ssiteName=trueHow do the parameters work? Can I customize the site name and delimiter?

siteName=trueparameter is mainly used fortdkTags are automatically appended to the page title with your website name, for example, "Page Title - Your Website Name", which helps enhance brand exposure.You can set the "Website Name" in the "Global Function Settings" on the backend.Regarding the separator,tdkTags provide asepparameters, for example{% tdk with name="Title" siteName=true sep=" | " %}Can I change the default hyphen (-) to?

Related articles

How to display contact information on the page, such as phone number, address, etc.

The contact information of the website is an important part of establishing user trust and providing convenient services.Whether it is displaying a simple phone number at the bottom of the website or providing detailed addresses and social media links on the "Contact Us" page, Anqi CMS offers a flexible and efficient way to manage and present these key information.This article will delve into how to set up and display all the contact information on your website using Anqi CMS, ensuring that your customers can easily find you.### Backend Management:Unified setting your contact information In AnQi CMS

2025-11-08

How to retrieve and display the system configuration information of the website in the template?

In website operation, we often need to display some global website information, such as the website name, Logo, filing number, copyright statement, as well as custom contact information or social media links.This information, if directly hardcoded in the template, would require searching and updating each page whenever a modification is needed, which is time-consuming and prone to errors.The AnQi CMS provides a very powerful and convenient template tag —— the `system` tag, which allows these system configuration information to be dynamically obtained and displayed in the template, greatly enhancing the maintainability and operational efficiency of the website.###

2025-11-08

How to customize a dedicated content display template for a specific document ID or category ID?

In website operations, we often encounter such needs: a particular product display page needs a unique layout to emphasize its features, or an important event special page needs special design to attract users, or a "About Us" single-page site wants to show a different brand character.Anqi CMS provides us with a flexible way, allowing us to customize exclusive display templates for these unique content needs, thus greatly enhancing the visual appeal and user experience of the website.The Anqi CMS template system has adopted the Django template engine syntax

2025-11-08

What is the default template file name for the document detail page and list page?

When using AnQiCMS for website building and content management, understanding the naming conventions of its template files is crucial for customizing and optimizing the website appearance.AnQi CMS to simplify template management, provides a flexible and default recognition naming convention, allowing website developers and operators to work more efficiently.First, all template files should be unified to use the `.html` suffix and placed in the `/template` folder under the website root directory.the styles and JavaScript scripts used in the template

2025-11-08

How to build and display a multi-level navigation menu for a website?

Website navigation, like the skeleton and compass of a website, it guides visitors to explore the website content, and is the core of user experience and information architecture.A clear and accessible navigation menu that not only helps users find the information they need quickly, but is also crucial for search engine optimization (SEO).AnQiCMS (AnQiCMS) is well-versed in this, providing powerful and flexible navigation management features that allow you to easily build and display multi-level navigation menus.Next, we will delve deeper into how to build and display your website navigation step by step in Anqi CMS.--- ### One

2025-11-08

How to display breadcrumb navigation on the page to enhance users' understanding of the content structure?

When we browse websites, we often see a line of text at the top or above the content area, clearly indicating the position of the current page within the overall website structure, like "Home > Product Center > Some Product Category > Some Product Detail" and so on.This is what we commonly refer to as 'Breadcrumb Navigation'.It can not only help users quickly understand the content hierarchy of the website, avoid getting lost, but also play an important role in user experience and search engine optimization (SEO).Aq CMS fully understands the importance of breadcrumb navigation

2025-11-08

How to use conditional judgment logic in a template to control the display and hiding of content?

In the presentation of website content, we often need to decide based on different situations which information should be displayed to visitors and which should be temporarily hidden.AnQiCMS (AnQiCMS) provides flexible template conditional judgment logic, making content display and hide intuitive and efficient.By these judgments, you can easily implement personalized page layouts, content display under permission control, and adjustment of page elements based on data status, which greatly enhances the dynamicity and user experience of the website.The Anqi CMS template system uses a syntax similar to the Django template engine

2025-11-08

How to iterate over list data in a template and display it one by one?

Managing and displaying content in Anqi CMS is one of its core advantages.When we need to display dynamic list data on the front end of a website, such as the latest articles, popular products, and content collections under categories, understanding how to efficiently iterate through these data in templates and display them one by one is an essential skill for website operators and template developers.The Anqi CMS template system adopts syntax similar to Django, which is intuitive and powerful, making the transformation of technical information and practical application extremely convenient.### Core Loop Syntax: `{% for %}`

2025-11-08