How to dynamically generate and display the page's Title, Keywords, and Description in AnQiCMS using the `tdk` tag?

Calendar 👁️ 58

In website operation, Title, Keywords, and Description (abbreviated as TDK) are the foundation of Search Engine Optimization (SEO).They not only describe the page content to search engines but also directly affect the click intention of users on the search results page.AnQiCMS as a content management system focused on, deeply understands the importance of TDK, and therefore provides a powerful and flexible mechanism that allows users to easily dynamically generate and finely manage the TDK of the website.

How to manage TDK in AnQiCMS: A systematic dynamic generation mechanism

AnQiCMS's TDK management starts from the homepage of the website.Under the 'Background Settings' menu in the background, find the 'Home TDK Settings' area, where you will see three input boxes: 'Home Title', 'Home Keywords', and 'Home Description'.Here, you can customize the exclusive TDK information for the homepage of the entire website, establishing an overall SEO tone for the site.

In addition to the homepage, AnQiCMS also provides independent TDK setting options for various content types on the website, which is the core embodiment of its dynamic generation capability.No matter whether it is an article, product, single page, category, or tag, you can find SEO-related fields in their respective editing interfaces.

  • Article and product detail page:When publishing or editing an article/product, in addition to the usual 'document title', 'document content', and 'document introduction', you will also see fields such as 'SEO title', 'document keywords', and so on.Among them, the "SEO title" allows you to set a special title for the current document that is displayed in search engines, which may be different from the H1 title displayed on the page, in order to better meet SEO requirements;“Document keywords” and “document summary” directly correspond to the page's Keywords and Description.If you choose to leave these fields blank, AnQiCMS will not leave the TDK missing, but will intelligently extract content from the 'Document Title' and 'Document Summary' to fill in, ensuring that each page has basic TDK information.
  • Categories and tags page: For the category and tag pages, you can also set the 'SEO title', 'keywords', and 'category/tag description'.This setting ensures that the category list page and the tag aggregation page can also have unique TDK, avoiding the repetition of TDK and thus improving the SEO value of these pages.
  • Single page:Pages like "About Us" and "Contact Us", which are independent single pages, also have exclusive TDK setting entries, including "SEO Title", "Keywords", and "Single Page Description", allowing each independent page to be precisely optimized.

This layered and detailed TDK management mode ensures that each important page of the website can have customized TDK, laying a solid foundation for the website to perform better in search engines.

How to call and display TDK tags in front-end templates

The background TDK information has been set up, the next step is how to correctly display it in the website front-end template. AnQiCMS provides powerfultdkTag. Usually, these TDK tags are placed in the HTML document's<head>area, which is the standard position for search engines to crawl and identify TDK information.

The following is the method to call different TDK information:

  1. Page Title (Title)Page's<title>Tags are one of the most important elements in SEO. In AnQiCMS templates, you can call them in the following way:

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

    This simple tag will automatically retrieve the title of the current page.It will prioritize displaying the "SEO title" you set on the content page (such as articles, categories), if not set, it will追溯 back to a higher level (such as categories, models) until the home page TDK setting.

    Furthermore,tdkThe tag is being calledTitleIt also provided more flexibility:

    • Attach website name:You can use it to automatically add the brand name of the website after the page title,siteName=trueparameters:
      
      <title>{% tdk with name="Title" siteName=true %}</title>
      
    • Custom separator:By default, the website name is separated from the page title with a hyphen. You cansepcustomize the separator parameter, for example using an underscore “_”:“
      
      <title>{% tdk with name="Title" sep="_" siteName=true %}</title>
      
    • Display parent category title:In some deeply nested content pages, 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 siteName=true %}</title>
      
  2. Page Keywords (Keywords)Page Keywords<meta name="keywords" content="...">Labels have decreased in weight in modern SEO, but they are still an important supplement to page information. You can call it like this:

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

    tdkThe tag will automatically aggregate keywords from the current page and its inheritance level.

  3. Page Description (Description)Page Description<meta name="description" content="...">Tags are an important source of search engine result summaries and have a direct impact on user click-through rates. The call method is as follows:

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

    AnQiCMS will intelligently select the description information set for the current page or its upper level for display.

  4. Standard Link (CanonicalUrl)Standard link<link rel="canonical" href="...">It is crucial for avoiding content duplication and specifying the preferred URL. AnQiCMS also provides dynamically generated specification links:

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

    One was used here.ifJudge, ensure that the label is only output when there is a standard link on the page, which is a robust practice.

The key to implementing dynamic TDK: hierarchy and priority

The strength of AnQiCMS's TDK management system lies in its intelligent dynamic generation and hierarchical inheritance mechanism. When you visit a specific page, AnQiCMS will retrieve TDK information in a certain priority order:

  1. Current Page Settings:The system will first check if there is an independent TDK setting for the current page (such as an article detail page, a category list page, a tag page, or a single page).If set, use this information directly.
  2. Inherit from Parent:If the current page is not set with TDK, the system will trace up to find whether the category or model it belongs to has been set.For example, if an article does not have a TDK set, it will try to use the TDK of its category.
  3. Global Default:If after searching through all layers and still no TDK information is found, AnQiCMS will eventually use the global information you configured in the "Home TDK Settings" as the TDK for this page.

This hierarchical inheritance mechanism greatly reduces the burden on content operators.You do not need to manually fill in TDK for each page, just set it at key points, and the system will intelligently fill in the gaps, ensuring that each page of the website has a complete TDK, which ensures flexibility and efficiency at the same time.

Through the above mechanism, AnQiCMS not only makes TDK management simple and efficient, but also provides strong technical support for website SEO optimization through its dynamic generation and intelligent inheritance features.

Frequently Asked Questions (FAQ)

Q1: What will AnQiCMS do if I haven't manually set the TDK for a certain page?A1: AnQiCMS will automatically process according to priority.If the TDK field of a specific content page (such as an article, a single page) is left blank, it will try to inherit the TDK of its parent page (such as the category, model).If the parent page is not set either, it will trace back and use the global TDK information you configured in the background "Home Page TDK Settings".

Q2: Can I set different TDK display formats for different page types (such as article detail pages and category list pages)?A2: Yes, you can. AnQiCMS'tdkThe tag can dynamically obtain the corresponding TDK content according to the page type.For example, the article detail page will automatically obtain the TDK of the article, and the category list page will automatically obtain the TDK of the category.At the same time, calling in the templatetdkWhen labeling, you can also usesiteName/sepandshowParentparameters to<title>customize the display format of labels to achieve finer control.

Q3: In TDK settings, what is the difference between the 'SEO title' and the displayed content on the actual page?<h1>What is the difference between the label content?A3: "SEO title" is a title specifically optimized for search engines, which will display on the page<title>in the tag, and as the search engine results page

Related articles

How does the `contact` tag display contacts, phone numbers, addresses, and social media links on the AnQiCMS page?

In website operation, clearly and accurately displaying contact information is crucial for building user trust and promoting communication and interaction.AnQiCMS provides a very convenient way to manage and display this information, that is, through the `contact` tag.This tag helps us easily call the preset contact name, phone number, address, and even social media links on any page of the website, without hard coding, greatly improving content management efficiency.### First step: Configure contact information in the AnQiCMS backend Before we start using `contact`

2025-11-08

How does the `system` tag display the website name, Logo, record number, and copyright information on the AnQiCMS website?

When building and operating a website, the website's name, logo, filing number, and copyright information are important elements that constitute the professional image and legality of the website.They are not only the identity of the website, but also the foundation of user trust.For users of AnQiCMS, the system provides a convenient and efficient way to manage and display these core information, which is through the powerful `system` tag.This article will delve into how to use the `system` tag on the AnQiCMS website to flexibly display the website name, Logo, filing number, and copyright information

2025-11-08

What naming conventions do AnQiCMS template files support to customize the display of specific pages or categories?

In AnQiCMS, in order to achieve personalized display of website pages or categories, we do not always have to write complex logic from scratch. The system provides a very flexible and intuitive naming convention for template files.These conventions allow us to create template files with specific names, enabling the system to automatically recognize and apply them to customize the display of different content types.First, understanding the basic structure of the template file is crucial.All template files are stored in the `/template` directory and use `.html` as the file extension.For example, a set named

2025-11-08

How to include common header, footer, and other code snippets in AnQiCMS templates to unify the display style?

How to include common header, footer, and other code snippets in AnQiCMS templates to unify the display style? When building a website, whether it's a personal blog, a corporate website, or a marketing site, maintaining consistency in page visuals and functionality is crucial.Imagine if each page's top navigation, footer copyright information, and even the sidebar were all different, the user experience would be greatly reduced, and the professionalism of the website would also be greatly reduced.

2025-11-08

How to build and display a multi-level navigation menu using the `navList` tag on the AnQiCMS website?

The website navigation is an important guide for users when they visit the website. It not only helps users find the information they need quickly, but also reflects the clear structure and friendly user experience of the website.In AnQiCMS, building flexible and diverse navigation menus is a relatively simple and efficient task, mainly due to its powerful `navList` tag.Whether it is a simple single-layer menu or a complex two-level dropdown menu, the `navList` tag can provide strong support.### `navList` label

2025-11-08

How does the `breadcrumb` tag display the breadcrumb navigation path of the AnQiCMS page?

In website operation, clear navigation is a key factor in improving user experience and helping search engines understand the structure of the website.This is a direct navigation aid that can clearly show the hierarchical path of the current page, allowing visitors to always know where they are and where they can go.For users who use AnQiCMS to build and manage websites, achieving such navigation is simple and efficient, thanks to its built-in `breadcrumb` tag.###

2025-11-08

How to retrieve and display the list of AnQiCMS articles or product categories using the `categoryList` tag?

Build a feature-rich, content-packed website in AnQiCMS, categories are an indispensable part of organizing content.Whether it is to display articles, products, services, or build navigation menus, a clear classification structure can greatly enhance the user experience and maintainability of the website.Today, let's delve deeply into a very practical and flexible tag in AnQiCMS——`categoryList`, which can help you easily obtain and display a list of articles or product categories.The `categoryList` tag is a powerful tool in the AnQiCMS template engine

2025-11-08

How does the `categoryDetail` tag display the specific category details of AnQiCMS, such as the introduction or Banner image?

In Anqi CMS template development, effectively displaying detailed category information is the key to improving website user experience and SEO performance.`categoryDetail` tag is born for this, it allows us to flexibly obtain and present various information of specific categories, from basic introduction text to visually stunning Banner images, it can easily handle.### Core Function Analysis: `categoryDetail` Tag Overview The `categoryDetail` tag is mainly used to obtain detailed data for a single category

2025-11-08