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.