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></p>}} <article> <!-- Prev / Next --> <div class="mt-12 pt-6 border-t border-gray-200 dark:border-gray-800"> <nav class="flex items-center justify-between gap-4"> <div class="flex-1"> <a href="https://en.anqicms.com/blog/6570.html" class="prev-next-link group flex flex-col items-start 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">Previous</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"> <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="M15 19l-7-7 7-7"/> </svg> How long after setting the TDK tags of Anqicms can it be indexed by search engines? </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 paid attention to when using the `tdk` tag of 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 Anqin CMS TDK tags can they be indexed by search engines?A deep analysis by an operation expert In the daily work of website operation, 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 theme and content of the page. Many users of AnQiCMS (AnQiCMS) are eager to know after carefully configuring these important tags: 'How long after setting my TDK tags will my page be indexed and displayed by search engines?'<h4></h4> <p class="text-xs text-gray-400 mt-1 line-clamp-2">As an experienced website operations expert, I am more than happy to delve into the close relationship between AnQiCMS (AnQiCMS) and the optimization of image Alt tags and TDK keywords.In the era where content is king, Search Engine Optimization (SEO) is the key to website success, and TDK (Title, Description, Keywords) and image Alt tags are indispensable elements in building this foundation.Anqicms is an efficient and 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 are fully aware that in the highly competitive digital world, Search Engine Optimization (SEO) is the foundation of website success.While TDK (Title, Description, Keywords) serves as the "front page" of website content, the accuracy of its configuration directly affects the search engine's understanding of the page content and the user's intention 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 during the content management and SEO optimization process.AnQiCMS (AnQiCMS) took full consideration of the needs of website operators from the very beginning, striving to achieve a balance between flexibility, functionality, and security.Today, let's delve deeply into the topic "Does the TDK tag content of Anqicms support HTML code or special characters?".As an experienced website operations expert, I know that TDK (Title, Description, Keywords) are crucial for a website's performance in search engines.Anqi CMS, with its SEO-friendly design concept, provides us with powerful and flexible TDK management capabilities. 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. ### How to Master AnQi CMS 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 AnQi CMS Title Tag?<h4> <p class="text-xs text-gray-400 mt-1 line-clamp-2">## The Secret of 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 the page, but also the primary information that users can determine at a glance in the search results.AnQi CMS 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 for AnQi CMS 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 the page, but also a direct factor for users to decide whether to click in the search results.AnQiCMS (AnQiCMS) understands this and is committed to providing users with efficient and customizable content management solutions, 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 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 more rich hierarchical information in the Title? </a><h4> <p class="text-xs text-gray-400 mt-1 line-clamp-2">Safe CMS, as an enterprise-level content management system that deeply understands the way of content operation, its powerful function design fully reflects a profound understanding of user needs and search engine optimization.The importance of page titles (Title) in website operation is self-evident, it is not only the first entry point 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 give the page title more rich and 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="Anqi Technology Security CMS" /> </div> <span class="text-lg font-bold text-gray-800 dark:text-gray-100">Anqi Technology Security CMS</span> </div> <p class="text-sm text-gray-500 dark:text-gray-400 leading-relaxed">Built with GoLang, reducing memory usage by about 80% compared to PHP CMS, supporting multiple sites, multi-language, AI intelligent dialogue and tool calls, an optimal solution for building high-performance websites for small and medium-sized enterprises. </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>