In website operation, the TDK (Title, Description, Keywords) information of the website plays a crucial role.They are not only the key for search engines to understand the content of the page, but also a crucial factor for users to decide whether to click on your website in the search results.An optimized TDK can significantly improve a website's ranking in search engines and attract more targeted users.AnQiCMS (AnQiCMS) is a content management system born for SEO optimization, naturally providing strong and flexible support for TDK management.

AnQiCMS integrates TDK configuration into every corner of the website, whether it is the homepage, specific articles, product pages, category pages, or even single pages and Tag pages, you can find the corresponding setting entry.For example, you can find the "Home Page TDK Settings" in the "Background Settings", which is specifically used to define the title, keywords, and description of the website's homepage.When you edit specific content, whether it is the 'Add Document' module's 'SEO Title', 'Document Keywords', 'Document Description', or the 'Document Category', 'Document Tags', 'Page Management' modules, all provide independent TDK configuration items to ensure that each page has a customized TDK information.

To dynamically display these TDK information in the AnQiCMS template, the key is to flexibly use its built-in "Universal TDK Tag" -tdk.The strength of this tag lies in its ability to intelligently fetch and output the corresponding TDK content based on the type of the current page (whether it's the homepage, article page, category page, or other), which greatly simplifies the development of templates.

Let's see how to use this in a templatetdkto display TDK information:

Flexible display of page title (Title)

The page title is usually<title>The content of the label has the greatest impact on SEO. UsetdkThe label retrieves the page title very directly.

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

In practical applications, we may want to automatically add the website name after the page title, or customize the separator.tdkAdditional parameters are provided for the tag:

  • Append website name suffix:If you want the site name configured in the “Global Settings” to be appended automatically after the page title, you can usesiteName=true.
    
    <title>{% tdk with name="Title" siteName=true %}</title>
    
  • Custom delimiter:By default, a hyphen is used between the site name and the page title-Comma, you can change it throughsepparameters.
    
    <title>{% tdk with name="Title" siteName=true sep="_" %}</title>
    
  • Display parent category title: Sometimes, on the article or category page, it is necessary to display the title of the parent category it belongs to, and it can be achieved throughshowParent=trueto achieve.
    
    <title>{% tdk with name="Title" showParent=true %}</title>
    
    Through the combination of these parameters, you can accurately control the display form of the page title according to your actual needs.

Output the page keywords (Keywords)

Page keywords (Keywords) are usually through<meta name="keywords" content="...">tags to set. Although modern search engines have reduced their weight, they still have value as auxiliary information.

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

If you want to store the obtained keywords in a variable for further processing, you can also do it like this:

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

Display page description (Description)

The page description (Description) is a summary located below the title in search engine results, which directly affects the user's desire to click.tdkTags can easily obtain the page description.

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

Similarly, it can also be stored in a variable:

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

Add a canonical link (CanonicalUrl)

The 'CanonicalUrl' is used to inform search engines which is the preferred version of the page, to avoid duplicate content issues.In AnQiCMS, you can set standard links for pages while editing content in the background.

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

Here, we use{%- ... -%}To remove the blank lines around the tags, making the output HTML cleaner.if canonicalThe judgment ensures that only when the page background is configured with a standard link,linkthe tag will be rendered to the HTML.

Where to place the TDK tag?

Generally speaking, these TDK-related<title>and<meta>tags should be placed in the website template's<head>within the area. In the template structure of AnQiCMS, this means they are most often added to the public header files, such astemplate/您的模板目录/partial/header.htmlortemplate/您的模板目录/bash.htmlThrough this method, all pages inheriting or referencing these public files can automatically have the correct TDK information without the need to repeat it in each individual page template.

Summary and Practical Suggestions

Reasonable configuration and use of TDK information is the foundation of website SEO optimization. AnQiCMS'stdkTags make this process efficient and intelligent. In content operation, it is recommended that you:

  1. Configure TDK for each page.Ensure that all important pages have unique, precise titles, keywords, and descriptions.
  2. Title is precise and attractiveThe title should include core keywords and be able to attract user clicks.
  3. Description should be concise and to the point: The description should summarize the page content, include relevant keywords, and encourage users to visit.
  4. Keywords should not be piled up:Keywords should be highly relevant to the page content and avoid overloading.
  5. Make good use of standard links.Especially when your website has pages with similar content or accessible via different URLs, it is essential to set up standard links.

By using the above method, you can fully utilize the TDK management capabilities of AnQiCMS to win better search engine performance for your website.


Common Questions (FAQ)

Q1: Why is the title of the article I set in the background not completely displayed in the browser's title bar?A1: AnQiCMS'stdkLabel may be affected by the default behavior when getting the page title.siteNameandshowParentFor example, if the template uses{% tdk with name="Title" siteName=true %}, then even if you only set the article title, the final title displayed in the browser will automatically append the website name. Please check the template code in yourtdkTagssiteNameandshowParentAre the parameters in line with your expectations, or you can directly fill in the complete title containing the website name in the 'SEO Title' when editing articles in the background.

Q2:tdkWhere does the 'universal' nature of the label manifest? How does it know the TDK information of the current page?A2:tdk

Q3: Why do I see it when addingCanonicalUrl?{%- if canonical %}such a judgment?CanonicalUrlWhat is its function?A3:CanonicalUrl(规范链接)is a very important SEO element, it is used to tell search engines the 'authoritative' version of a page.When the content of the website can be accessed through multiple URLs (for example, the same article exists with and without parameters, or there is duplicate content under different categories), search engines may find it difficult to determine which version is the preferred one, which may分散页面的排名权重分散页面的排名权重.Set the specification link to concentrate these weights and enhance SEO effect.{%- if canonical %}The judgment is to ensure that only when the backend has indeed set the standard link for the current page, will it output in the HTML of the page<link rel="canonical" ...>Label. This can avoid outputting empty or unnecessary specification links, maintaining the cleanliness and standardization of HTML.