How to customize the display logic of Title, Description, and Keywords in AnQi CMS template?

Calendar 👁️ 46

As an old soldier who has been deeply involved in website operations for many years, I know that every detail can affect the performance of a website in search engines.Among them, Title (title), Description (description), and Keywords (keywords) - commonly known as TDK, are the foundation of website SEO optimization.They are like the 'front door' and 'map' of a website, directly telling search engines and users what your page is about.

In AnQiCMS (AnQiCMS) such an efficient and customizable Go language content management system, customizing the display logic of TDK is not only flexible and convenient, but also helps us finely control the SEO strategy.Today, let's delve into how to cleverly customize the display logic of these key elements in the AnQiCMS template.

AnQiCMS TDK strategy: layered and flexible

AnQiCMS provides a hierarchical, step-by-step coverage strategy in TDK management, greatly enhancing our operational flexibility.This means that you can fine-tune the TDK for every page of the website from macro to micro.

First, inGlobal SettingsIn Chinese, you can configure TDK for the homepage of the entire website.This is usually a reflection of your brand name, core business, and overall positioning.In the "Homepage TDK settings

Furthermore, AnQiCMS allows you toat the content levelSet independent TDK for each specific content (such as articles, products, single pages, category pages, and tag pages).For example, when publishing a document, in addition to the article title and content, you will find special fields such as 'SEO Title', 'Document Keywords', and 'Document Summary'.The purpose of these fields is to allow you to optimize the search engine visibility of each piece of content specifically.Similarly, in "Document Classification

The elegance of this layered design lies in the fact that when a page has both global TDK and content TDK, the content-level TDK is often read first, thereby achieving more precise SEO control. The final TDK presented to the user is determined by yourTemplate codeDecide how to parse and display these data.

Core Tool: Universal TDK Tag{% tdk %}Exquisite application

The AnQiCMS template system uses a syntax similar to the Django template engine, one of the very powerful built-in tags being{% tdk %}. It is designed as a 'universal tag' that can intelligently capture and output the corresponding TDK information according to the current page type (home page, article page, category page, etc.).

Customization of Title (Page Title)

in the template's<head>area, you can use{% tdk with name="Title" %}Output the page's Title tag content.This label is very intelligent, it will try to get the content level (such as articles, categories, single-page SEO titles) according to the context of the current page first, and if it is not set, it will fall back to the general title of the content, and finally fall back to the global home page title.

What's even better is,{% tdk name="Title" %}and also provides several practical parameters:

  • siteName=trueIf you want the website name to be automatically appended to the page title, you can set it totrueFor example,{% tdk with name="Title" siteName=true %}It may output 'Article Title - Your Website Name'.
  • sep="_"You can customize the separator between the website name and the page title, for example, set it to an underscore_.
  • showParent=true: Under some category pages, you may want the Title to display the title of the parent category, and this parameter can help you achieve that.

For example, in yourbase.htmlHeader:

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

Control of Keywords (page keywords) and Description (page description)

For Keywords and Description, the usage is similar to Title:

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

They will also match intelligently based on the page context, prioritizing keywords and descriptions set at the content level, followed by their regular introduction, and finally falling back to the global settings.

The introduction of Canonical Url (standard link)

In SEO, standard linksCanonical UrlAre crucial for handling duplicate content. AnQiCMS also provides{% tdk with name="CanonicalUrl" %}The link to display the page standard. When content is published, if the article or single page is set to standard link, it will be output here. **Practical condition judgment:

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

This ensures that the label is only output when there is a standard link, keeping the code tidy.

Practical exercise in customizing TDK display logic.

Though{% tdk %}The tag is already smart, but in some specific business scenarios, we may need a more refined and prioritized TDK display logic.AnQiCMS's template flexibility allows us to directly write judgments in the template and customize the process of retrieving data.

Assuming you want to implement such logic on the article detail page:

  1. Use the article's own 'SEO title' first.
  2. If the "SEO title" is empty, then use the article's "Document title".
  3. Finally, add the website name uniformly.

You can use the article detail template (such asarchive/detail.html)的<head>parts are written like this:

`html {% set pageTitle = "

{% set pageTitle = seoTitle %}

{% else %}

{# 如果SEO标题为空,则获取文章的常规标题 #}
{% archiveDetail articleTitle with name="Title" %}
{% set pageTitle = articleTitle %}

{% endif %}

{# Get the website name #} {% system siteName with name=“SiteName” %}

{# Combined Final Title #}</p>\n\n \n </article>\n\n <!--- Prev / Next -->\n \n <div class=\ </span> </a> </div> <div class="flex-1 justify-end"> <a href="https://en.anqicms.com/blog/6572.html" class="prev-next-link group flex flex-col items-end px-5 py-3 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-400 transition-all duration-200 min-w-[140px]"> <span class="text-xs text-gray-400 dark:text-gray-500 mb-0.5">Next</span> <span class="text-sm font-medium text-gray-700 dark:text-gray-300 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors flex items-center gap-1"> What parameters should be noted when using the `tdk` tag in Anqicms? <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path> </svg> </span> </a> </div> </nav> </div> <!-- Related articles -->\n <div class=\<h4> <p class="text-xs text-gray-400 mt-1 line-clamp-2">How long after setting the AnqinCMS TDK tags can they be indexed by search engines?A deep analysis by an operations expert In the daily work of website operations, the setting of TDK (Title, Description, Keywords) tags is undoubtedly the cornerstone of SEO optimization.They are the key windows for search engines to understand the topic and content of a page.Many users of AnQiCMS (AnQiCMS), after carefully configuring these important tags, will be eager to know: 'How long will it take for my TDK tags to be indexed and displayed by search engines after they are set?'<p> <span class="text-xs text-gray-400 mt-2 block">2025-11-07</span> </a> <a href="https://en.anqicms.com/blog/6569.html" class="p-4 rounded-xl bg-gray-50 dark:bg-gray-900 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-gray-100 dark:border-gray-800 transition-colors group"> <h4 class="text-sm font-medium text-gray-800 dark:text-gray-200 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">What is the relationship between the AnQiCMS image alt tag and TDK keywords? </h4> </a><h4></h4> <p class="text-xs text-gray-400 mt-1 line-clamp-2">As an experienced website operation expert, I am more than willing to delve deeply into the close correlation of AnQiCMS (AnQiCMS) in terms of image Alt tag and TDK keyword optimization.In today's content is king era, Search Engine Optimization (SEO) is the key to website success, and TDK (Title, Description, Keywords) and image Alt tags are the indispensable elements to build this foundation.Anqicms is an efficient, SEO-friendly content management system</p> <span class="text-xs text-gray-400 mt-2 block">2025-11-07</span> </a> <a href="https://en.anqicms.com/blog/6568.html" class="p-4 rounded-xl bg-gray-50 dark:bg-gray-900 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-gray-100 dark:border-gray-800 transition-colors group"> <h4 class="text-sm font-medium text-gray-800 dark:text-gray-200 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">How to configure differentiated TDK strategies for different content models in Anqicms?<h4> <p class="text-xs text-gray-400 mt-1 line-clamp-2" ## AnQiCMS Content Operation: Tailor-made TDK Optimization Strategy for Different Content Models As a senior website operation expert, we know that in the highly competitive digital world, Search Engine Optimization (SEO) is the foundation of website success.While TDK (Title, Description, Keywords) acts as the 'face' of website content, its accuracy directly affects how search engines understand the page content and the willingness of users to click.In AnQiCMS (AnQiCMS) such an efficient</p> <span class="text-xs text-gray-400 mt-2 block">2025-11-07</span> </a> <a href="https://en.anqicms.com/blog/6567.html" class="p-4 rounded-xl bg-gray-50 dark:bg-gray-900 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-gray-100 dark:border-gray-800 transition-colors group"> <h4 class="text-sm font-medium text-gray-800 dark:text-gray-200 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">Does AnQiCMS's TDK tag content support HTML code or special characters??As an experienced website operations expert, I fully understand your concerns about the compatibility of TDK tag content in the process of content management and SEO optimization.AnQiCMS (AnQiCMS) was designed with the needs of website operators in mind, striving to achieve a balance between flexibility, functionality, and security.Today, let's delve into whether the TDK tag content of Anqi CMS supports HTML code or special characters?This topic. ### Deeply understand the TDK mechanism of Anqicms In Anqicms</p> <span class="text-xs text-gray-400 mt-2 block">2025-11-07</span> </a> <a href="https://en.anqicms.com/blog/6572.html" class="p-4 rounded-xl bg-gray-50 dark:bg-gray-900 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-gray-100 dark:border-gray-800 transition-colors group"> <h4 class="text-sm font-medium text-gray-800 dark:text-gray-200 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">What parameters should be paid attention to when using the `tdk` tag in Anqicms?As an experienced website operations expert, I know that TDK (Title, Description, Keywords) are crucial for a website's performance in search engines.The AnQi CMS provides us with powerful and flexible TDK management capabilities with its SEO-friendly design philosophy.Today, let's delve into the various parameters that need to be paid attention to when using the `tdk` tag in Anqi CMS, to help everyone better master this SEO core element. ### Mastering Anqicms TDK Tags</p> <span class="text-xs text-gray-400 mt-2 block">2025-11-07</span> </a> <a href="https://en.anqicms.com/blog/6573.html" class="p-4 rounded-xl bg-gray-50 dark:bg-gray-900 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-gray-100 dark:border-gray-800 transition-colors group"> <h4 class="text-sm font-medium text-gray-800 dark:text-gray-200 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">What is the difference between `siteName=true` and `siteName=false` in the Title tag of Anqicms?The secret of the Title tag in AnQi CMS: Deep analysis of `siteName=true` and `siteName=false` In the daily operation of AnQi CMS, we know that every detail of the website may affect its performance in search engines and the willingness of users to click.The title tag serves as the 'face' of a webpage, its importance is self-evident.It is not only a key signal for search engines to understand the theme of a page, but also the primary information that users can determine at a glance in the search results.Anqicms as an efficient and customizable content management system</p> <span class="text-xs text-gray-400 mt-2 block">2025-11-07</span> </a> <a href="https://en.anqicms.com/blog/6574.html" class="p-4 rounded-xl bg-gray-50 dark:bg-gray-900 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-gray-100 dark:border-gray-800 transition-colors group"> <h4 class="text-sm font-medium text-gray-800 dark:text-gray-200 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">How to customize the separator of Anqicms page title with the `sep` attribute?In today's digital world, every detail of a website can affect its performance in search engines and the first impression of users.The page title (Title) serves as the 'face' of the website content, its importance is self-evident.It is not only a key clue for search engines to understand the theme of a page, but also a direct factor for users to decide whether to click in the search results.AnQiCMS (AnQiCMS) knows this and is committed to providing users with an efficient, customizable content management solution, including fine-grained control over page titles.As an experienced website operation expert</p> <span class="text-xs text-gray-400 mt-2 block">2025-11-07</span> </a> <a href="https://en.anqicms.com/blog/6575.html" class="p-4 rounded-xl bg-gray-50 dark:bg-gray-900 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-gray-100 dark:border-gray-800 transition-colors group"> <h4 class="text-sm font-medium text-gray-800 dark:text-gray-200 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">How Anqicms uses the `showParent=true` attribute to display richer hierarchical information in the Title?<h4></h4> <p class="text-xs text-gray-400 mt-1 line-clamp-2">AnQi CMS, as an enterprise-level content management system that deeply understands the way of content operation, its powerful functional design reflects a profound understanding of user needs and search engine optimization.The importance of the page title (Title) in website operation is self-evident, it is not only the first entry for users to click, but also the core basis for search engines to judge the relevance of page content.Today, let's delve into how Anqi CMS cleverly uses the `tdk` tag's `showParent=true` attribute to enrich the page title with more hierarchical information</p> <span class="text-xs text-gray-400 mt-2 block">2025-11-07</span> </a> </div> </div> </div> </div> <!-- ==================== FOOTER ==================== --> <footer class="border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-[#0f172a]"> <div class="max-w-[1440px] mx-auto px-4 sm:px-6 lg:px-8 py-12"> <div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-8"> <div> <div class="flex items-center gap-2.5 mb-4"> <div class="w-8 h-8 flex items-center justify-center"> <img src="https://en.anqicms.com/uploads/202606/15/2144e205d561d0a5.webp" alt="搜外科技安企CMS" /> </div> <span class="text-lg font-bold text-gray-800 dark:text-gray-100">搜外科技安企CMS</span> </div> <p class="text-sm text-gray-500 dark:text-gray-400 leading-relaxed">Based on GoLang, memory usage is reduced by about 80% compared to PHP CMS, supports multiple sites, multi-language, AI intelligent conversation and tool calls, is the preferred solution for small and medium-sized enterprises to build high-performance websites.</p>\n <div class=\ al.src = "/api/log?action=views&code=200&id=6571&path=http%3A%2F%2Fwww.anqicms.com%2Fblog%2F6571.html&type=archive&nonce="+Date.now(); document.body.appendChild(al);())) </script> </html>