How to call and display the TDK (title, keywords, description) information of the page in AnQiCMS template?

Calendar 👁️ 67

In website operation, TDK (Title, Keywords, Description) information plays a vital role, directly affecting the visibility and click-through rate of the website in search engines.As a "business card" displayed on the website, the reasonable setting of TDK is the foundation of SEO optimization.AnQiCMS as a content management system focusing on SEO optimization naturally provides users with flexible and powerful TDK management and call functions.

AnQiCMS's TDK management mechanism

AnQiCMS fully understands the importance of TDK and therefore, in the system design, has carefully divided and managed the settings of TDK. You can set TDK information at multiple levels for the website to ensure that each page has unique and accurate metadata:

  • Site-wide Home Page TDK:In the background "Background Settings" -> "Home TDK Settings", you can configure a unified title, keywords, and description for the entire website's homepage.This is the most basic TDK setting of the website, which is crucial for brand promotion and the coverage of core business keywords.
  • Content Page TDK:Whether it is an article, product details page, or a single category page, custom single page, AnQiCMS allows you to set independent TDK settings.When editing this content, you will usually see fields such as "SEO titleFor example, when adding a document, there are 'SEO Title' and 'Document Keywords'; in the document category settings, there are 'Category Description' and 'Keywords', etc., which will take precedence over the homepage TDK on the corresponding page.
  • Canonical URL:In addition to the traditional TDK, AnQiCMS also provides the function to set up specification links.Standard links can effectively avoid SEO problems caused by content duplication and indicate which is the 'authoritative' version of the page to search engines.

This layered management mechanism ensures that each page's TDK can be optimized according to the uniqueness of its content, greatly enhancing the SEO performance of the website.

In AnQiCMS template, call TDK information

AnQiCMS uses a template engine syntax similar to Django, calling and displaying TDK information through specific tags. This 'universal' tag is{% tdk %}. These TDK tags are usually placed in the template file<head>area so that the browser and search engines can correctly identify

the page title (<title>)

The page title usually contains the most important information and is the largest text displayed in search engine results. In the AnQiCMS template, you can call the page title using the following method:

<title>{% tdk with name="Title" %}</title>

Furthermore,{% tdk with name="Title" %}The tag supports some practical attributes to make the title display more flexible:

  • Attach website name:If you want to automatically add the website name at the end of the page title, you can usesiteName=trueattributes. For example:

    <title>{% tdk with name="Title" siteName=true %}</title>
    

    Such, a page title of an article may be "My Article Title - AnQiCMS", without manual concatenation.

  • Custom separator:By default, the website name and page title are separated by a hyphen. You cansepcustomize the separator attribute, for example, using an underscore_:

    <title>{% tdk with name="Title" sep="_" siteName=true %}</title>
    
  • Display the title of the parent category:For the category page, sometimes you may want to reflect the name of the parent category in the title, in which case you can useshowParent=true:

    <title>{% tdk with name="Title" showParent=true %}</title>
    

invoke the page keywords (<meta name="keywords">)

Keyword tags are used to provide search engines with keyword hints for page content. Although their weight is not as strong as before, reasonable settings are still a good practice.

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

Page description call (<meta name="description">)

The page description is a brief summary below the title in search engine results, which directly affects the user's click intention.

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

Link specification (<link rel="canonical">)

Standard links help to solve the problem of duplicate content, guide search engines to identify the main version of the page.

{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}

Here, we first concatenateCanonicalUrlThe value is assigned to a variablecanonicalThen proceed{% if canonical %}Determine whether the link exists, and only render when it exists.<link rel="canonical">Label, this is a more rigorous and recommended practice.

Application and practice with **

To ensure that the TDK information is displayed correctly on all pages, it is recommended to place the above TDK tags in your universal template file (such asbash.htmlorheader.html)的<head>Within the area. The template inheritance mechanism of AnQiCMS allows these global settings to be easily applied to all pages that inherit the basic template.

Remember these points when setting up TDK:

  • Uniqueness:Try to ensure that each page's TDK is unique to avoid repetition.
  • Relevance:The title, keywords, and description should be highly relevant to the page content.
  • Readability:Description information is not only for search engines, but also for users, striving to be concise and attractive.
  • Length limit:Adhere to the character length recommendations for the title and description by search engines to avoid content truncation.

By using the powerful TDK management and flexible template calling mechanism provided by AnQiCMS, you can effectively optimize the website's SEO and improve its performance in search engines.

Frequently Asked Questions (FAQ)

  1. Why did I set the TDK of an article, but the page still displays the TDK of the homepage? Answer:AnQiCMS handles TDK processing in accordance with certain priority rules.Generally, the TDK (such as articles, categories, and independent settings of single pages) set by the page itself will take precedence over its superior (such as category TDK taking precedence over home page TDK) or the default TDK of the entire site.If you find that the settings are not working, please first check if the TDK on this page has been filled in and saved correctly, and then check if the TDK tags are called correctly in the template.If the page does not have a specific TDK set, the system will automatically search upwards until it finds available TDK information (for example, if the article does not have a TDK set, it will try to use the TDK of its category; if the category does not have one, it will use the TDK of the homepage).

  2. I added in the template{% tdk %}Tag, but the corresponding TDK information is not displayed in the page source, what is the reason? Answer:This usually has several reasons:

    • Spelling error in tag:Check{% tdk %}Tag and its attributesnameIs it completely correct, including uppercase and lowercase?
    • The TDK content is not set:The page or its parent level may not have set the corresponding title, keywords, or description content in the background, causing the label to output as empty.
    • The template file location is incorrect:The TDK tag should be placed in the HTML document's<head>area, if placed incorrectly, it may cause the browser to fail to parse or render.
    • Cache problem:AnQiCMS may have page caching, causing newly modified templates or content to not take effect immediately. Try clearing the website cache in the background or refreshing the page.
  3. Ask: Can I dynamically insert tags or publication dates of articles in the page description? Answer: {% tdk %}The tag itself is used to directly call the already set TDK fields. If you want to dynamically combine page descriptions or keywords, you need to first obtain the required data in the template (for example, using{% archiveDetail %}Retrieve article information or{% tagList %}Then pass this information through{% set %}or{% with %}Combine the tags into a new string variable and then assign this variable to the TDK field.However, directly modifying the TDK field in the background settings is simpler and more direct, while dynamic composition is usually used for highly customized SEO needs.

    {% archiveDetail currentArchive with name="Description" %}
    {% tagList tags with itemId=currentArchive.Id %}
    {% set customDescription = currentArchive.Description ~ ",标签有:" %}
    {% for item in tags %}
    {% set customDescription = customDescription ~ item.Title ~ " " %}
    {% endfor %}
    <meta name="description" content="{{ customDescription|trim }}">
    

    This method is flexible, but in practice, it should ensure the accuracy and uniqueness of the generated content.

Related articles

How does AnQiCMS avoid SEO issues caused by duplicate content through setting the canonical URL?

In website operation, content duplication is a common but often overlooked issue that may silently erode the SEO results we have worked hard to accumulate.When a search engine crawls and indexes website content, if it finds multiple URLs pointing to the same or highly similar content, it may fall into a This confusion can not only lead search engines to lower the weight of these duplicate pages, but may also affect the ranking of the entire website.As a content operator

2025-11-07

How to configure the Title, Keywords, and Description on the homepage of the AnQiCMS backend?

When operating a website, the Title (title), Keywords (keywords), and Description (description) on the homepage, commonly known as TDK, are the first threshold for search engines to understand the content of our website.They directly affect the display effect and click-through rate of websites in search results, which is crucial for the search engine optimization (SEO) of the website.AnQiCMS (AnQiCMS) fully understands the importance of these elements, and therefore provides a very intuitive and convenient TDK configuration function in the background, allowing you to easily manage even without a strong technical background.

2025-11-07

How to set custom URL aliases for articles, categories, and tags in AnQiCMS?

In AnQiCMS, setting up custom URL aliases for articles, categories, and tags is a very useful feature. It not only makes your website links more readable but also greatly benefits search engine optimization (SEO).A clear, keyword-rich URL, like a roadmap for search engines and users, helps enhance the professionalism and traffic of the website.AnQiCMS was designed with SEO-friendliness in mind from the beginning, featuring powerful static and URL alias management functions.This means you can convert the originally dynamic, complex parameterized link into a concise

2025-11-07

How to configure the Robots.txt file through the AnQiCMS backend to control the crawling behavior of search engines?

## Easily configure Robots.txt using AnQiCMS: Precisely control the search engine crawling behavior In the many aspects of website operation, it is crucial to allow search engines to efficiently understand and crawl your website content.And the `Robots.txt` file is the first door of communication between you and the search engine, playing the role of a 'traffic commander' for the website, directing the search engine crawlers (Crawler) which pages can be accessed and which pages should not be accessed.AnQi CMS understands the importance of SEO, therefore will Robots

2025-11-07

Does AnQiCMS support Json-LD structured data output and how to customize its content?

AnQiCMS support for Json-LD structured data, as well as how to customize its content, is a frequently discussed issue by many users concerned about website SEO performance.As a system dedicated to improving content management efficiency and SEO optimization, AnQiCMS provides flexible and powerful functions in this aspect. ### AnQiCMS supports native Json-LD structured data Firstly, AnQiCMS indeed supports Json-LD structured data output.

2025-11-07

How to efficiently display the AnQiCMS article list and support multiple sorting, filtering, and pagination methods?

Efficiently display article lists in AnQiCMS and support various sorting, filtering, and pagination methods, which is the core link of content management.Understanding the flexible application of template tags can help you build highly customized and user-friendly content display pages. To achieve this goal, we mainly rely on the powerful template tag system of AnQiCMS, especially the core **`archiveList` tag**,配合**`pagination` tag** and various auxiliary filters and logical controls.### One, Core

2025-11-07

How to implement unified management and display of multi-site content in AnQiCMS?

Managing multiple websites can be a headache, as each site requires a separate system to maintain, which not only consumes a lot of time and effort but may also lead to a lack of consistency in brand image, delayed content updates, and difficulties in centralized data analysis and SEO optimization.Imagine if you could easily manage all the content of sites from a single backend and flexibly control their display, how efficient that would be!AnQiCMS is born to solve such pain points.It is not simply to allow you to run multiple independent CMS on the same server, but to provide a centralized solution that enables you to maintain a unified

2025-11-07

How to use the flexible content model of AnQi CMS to customize the display structure of content?

## Unlock the potential of content: Use AnQi CMS flexible content model to customize display structure In today's fast-changing digital world, website content is no longer just simple articles and pages.For many operators, it may include a variety of products, captivating activities, professional detailed project cases, and even unique team member introductions.Traditional content management systems (CMS) often use a fixed content structure, forcing diverse information to be cramped into the 'title' and 'body' boxes, resulting in a monotonous display of content and a greatly reduced user experience

2025-11-07