How to get the SEO title, keywords, and description of the current document and use it in the page Meta tags?

Calendar 👁️ 65

As an expert deeply familiar with website operation, I know the importance of SEO titles, keywords, and descriptions (usually referred to as TDK, Title, Description, Keywords) for a website to perform well in search engines.They are the information that users first see on the search results page, directly affecting the click-through rate, and are also a key signal for search engines to understand the content of the page.In AnQiCMS (AnQi CMS), obtaining and applying these key SEO information becomes intuitive and efficient due to its powerful and flexible template system and backend configuration features.

Today, let's delve into how to accurately obtain the SEO title, keywords, and description of the current document in AnQiCMS, and巧妙ly apply them to the page Meta tags to win more exposure for your website.


AnQiCMS SEO实战:How to accurately obtain and apply page Meta tag information?

In today's fiercely competitive digital environment, every website operator aspires for their content to stand out in search engines.And the Meta tags on the page - especially the SEO title, keywords, and description - are the "business card" we show to search engines and potential users to present the essence of the content.AnQiCMS is a system designed for SEO-friendliness, providing us with a simple and efficient way to manage and deploy these crucial information.

I. How does AnQiCMS manage document SEO information?

AnQiCMS manages SEO information deeply at all levels of content publication, ensuring that you can finely control every bit of content:

  1. Document (article/product) level:This is the most direct, finest-grained control point. When you are writing or editing any onearticle or productAt the "Other ParametersThe TDK entered here will be directly applied to the detail page of this document, with the highest priority.
  2. Category level:in managementDocument CategoryAt the same time, you can also set the 'SEO title', 'keywords', and 'category description' for each category.This information will be applied to the list page of the category.If a document under a category does not have a TDK set individually, the system may trace up and use the TDK of its category as the default value.
  3. Single page level:For "About Ussingle pageSimilarly, the page management interface provides settings options for "SEO Title
  4. Global (Home) Level:Under the "Backend Settings" and "Home TDK Settings", you can set for the entire website,HomeDefine TDK.This usually serves as the final fallback for all pages, that is, if no specific page or category has set TDK, the system will try to use the global TDK of the website or intelligently extract it from the page content.

This hierarchical design ensures the flexibility and coverage of SEO information, allowing you to strategically deploy according to the importance of content and business needs.

Part two: UsingtdkLabel to get SEO information

AnQiCMS's template system uses syntax similar to Django, through powerful built-in tags, you can easily call various data configured in the background on the front-end page. For page Meta information, AnQiCMS provides a 'universal'tdkA tag that can intelligently identify the current page type (whether it is document details, category list, single page, or home page), and automatically extract the most matching SEO data.

Let's see how to use it:

1. Get the page title (Title)

Page's<title>Tags are the most important part of SEO. UsetdkTags to get the SEO title of the current page is very direct:

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

This tag automatically retrieves the **SEO title of the current page. It also provides some very useful parameters to further customize:

  • siteName=true: Will automatically append the website name at the end of the title, for example, 'Article Title - Your Website Name.'
  • sep=" - ": Can customize the separator when appending the website name, default is a hyphen.
  • showParent=trueIn some cases (such as the category page), the title of the parent category can be displayed.

Example code:

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

2. Get the page keywords (Keywords)

KeywordsTags may have decreased in weight in modern SEO, but they are still an effective way to provide search engines with a page content topic hint:

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

tdkThe tag automatically extracts keywords from the current page, category, or global settings and outputs them in the form of a comma-separated list.

3. Get page description (Description)

Page description (Meta Description) is the content summary that users see in search results, an attractive description can significantly increase click-through rate:

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

tdkThe tag will intelligently retrieve the page's Meta Description.If the document or category does not have a description set explicitly, the system will usually extract a paragraph from the document summary or main content as the default description.

4. Obtain the specification link (CanonicalUrl)

CanonicalUrlIt is an advanced SEO tool used to resolve content duplication issues, informing search engines which is the 'authoritative' version of the content:

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

Here we first need toCanonicalUrlAssign a value to a variable namedcanonicalThen check if it exists. Only when the specification link exists will we output this on the page<link>Label, this is a strict and recommended practice.

III. Practical Application: Deploy SEO information to the page Meta tag

In order for these SEO information to truly take effect, we need to place them in the website template's<head>area. In AnQiCMS, it is usually recommended to place the general layout files of the website (such astemplateUnder the directorybash.htmlorbase.htmlConfigure in the bracket. This way, all pages inheriting the layout can automatically have the correct Meta tags.

Here is a typical HTML<head>area, integrating the abovetdkLabel example:

`html &lt;!DOCTYPE html&gt;

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

{# 页面标题,附加网站名称作为后缀 #}
<title>{% tdk with name="Title" siteName=true sep=" - " %}</title>

{# 页面关键词 #}
<meta name="keywords" content="{% tdk with name="Keywords" %}">

{# 页面描述 #}
<meta name="description" content="{% tdk with name="Description" %}">

{# 规范链接,避免内容重复问题,仅在存在时输出 #}
{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}

{# 引入CSS文件等其他头部资源 #}
<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">
{# 您可能还需要引入多语言切换的hreflang标签 #}
{%- languages websites %}
{%- for item in websites %}
<link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
{%- endfor %}
{%- endLanguages %}

{# 其他SEO相关的Meta标签,例如Open Graph, Twitter Cards等,可根据需求自行添加 #}

Related articles

How to combine `archiveList` with `pagination` tag to implement pagination navigation for document list?

As an experienced website operation expert, I am well aware of the importance of an efficient content management system (CMS) for website operation. AnQiCMS, with its high concurrency features in Go language and flexible template mechanism, has provided us with great convenience.Among many features, how to effectively display a large number of documents and provide friendly pagination navigation is crucial for improving user experience and content accessibility.Today, let's delve into how the `archiveList` tag cleverly combines with the `pagination` tag

2025-11-06

How to display the Flag attribute of the document in the `archiveList` loop, for example, 'Recommended' or 'Bold'?

As an experienced website operations expert, I am happy to deeply analyze how to flexibly use the `archiveList` loop in AnQiCMS to display the Flag attribute of documents, such as "recommended" or "bold".The core of content operation lies in how to effectively distinguish and highlight key content, and the Flag attribute is a powerful and easy-to-use feature provided by AnQiCMS for this purpose.--- ### Light up your content

2025-11-06

How to get the thumbnail, description, and publish time of the document in the `archiveList` loop?

As an experienced website operations expert, I know that how to efficiently and flexibly display content in a content management system is one of the key factors for the success of a website.AnQiCMS (AnQi CMS) relies on its powerful template engine and simple tag design, making content display extremely convenient.Today, let's delve into a very practical scenario: how to elegantly obtain and display the thumbnail, description, and publication time of documents in the `archiveList` loop.

2025-11-06

How to call the document data of different sites (`siteId`) through the `archiveList` tag?

As an experienced website operations expert, I fully understand the challenges you may encounter when managing multi-site content.AnQiCMS (AnQiCMS) provides us with great convenience with its powerful multi-site management capabilities.Today, let's delve into how to use the `archiveList` tag and its core parameter `siteId` to easily implement cross-site document data calls.

2025-11-06

How does the `archiveDetail` tag in AnQiCMS control the Markdown rendering or lazy loading of document content?

As an experienced website operations expert, I know that in the increasingly fierce online environment, efficient content management and elegant presentation are crucial for the success of a website.AnQiCMS is a powerful and flexible content management system that provides us with great convenience with its template tag system.Today, let's delve deeply into a seemingly simple yet powerful tool: the `archiveDetail` tag of AnQiCMS, especially its mysteries in controlling the Markdown rendering and lazy loading of document content.

2025-11-06

How to get the custom model field content of the `archiveDetail` tag?

In the powerful and flexible AnQiCMS content management system, the content model plays a core role, allowing us to build various personalized content structures according to business needs.Whether it is articles, products, activities, or other custom information, we can define unique fields for them.How can you elegantly present these rich custom field contents on the front-end page, which has become the key to template development.

2025-11-06

How to create a document filtering interface with the `archiveFilters` tag?

AnQi CMS is an efficient and customizable enterprise-level content management system, dedicated to providing powerful and flexible content management tools for website operators.In daily operations, we often need to provide users with a diverse range of content filtering functions to help them quickly find the information they are interested in.At this time, the `archiveFilters` tag provided by AnQi CMS can fully display its capabilities, allowing us to easily build a multi-condition document filtering interface, greatly enhancing the user's content discovery experience.### Understand `archiveFilters`

2025-11-06

How to iterate over and display each filter parameter's optional values and their corresponding links for the `archiveFilters` tag?

Good, as an experienced website operation expert, I am happy to delve into the exquisite features of the `archiveFilters` tag in AnQi CMS and guide you on how to flexibly apply it in practice to build a beautiful and practical content filtering function. --- ## Deep Analysis of AnqiCMS: `archiveFilters` tag, building a dynamic content filtering tool In the world of content management, how to help users quickly find the information they need is the key to improving website experience and conversion rates.Deeply understands this path of AnQi CMS

2025-11-06