How to dynamically set and call the SEO title, keywords, and description (TDK) of the current page in the template?

Calendar 👁️ 71

As a senior CMS website operation personnel of an enterprise, I know that high-quality content and excellent search engine optimization (SEO) are the foundation of website success.Among them, the SEO title (Title), keywords (Keywords), and description (Description) of the page, abbreviated as TDK, play a crucial role.They are not only the key for search engines to understand the content of the page, but also important factors to attract users to click.In AnQi CMS, we have a flexible and powerful mechanism to dynamically set and call these TDK information, ensuring that each page gets **good SEO performance.

Understand the TDK hierarchy and priority in Anqi CMS

In AnQi CMS, the TDK settings have a clear hierarchy, the system will intelligently determine the final effective TDK based on the page type and specific settings.

First, the website existsGlobal TDK settingsThis is mainly reflected in the "Home Page TDK Settings" on the back end. The title, keywords, and descriptions set here will serve as the default TDK for the website, especially suitable for the home page.

Secondly, for specific content entities such asarticles, products, categories, single pagesThe AnQi CMS provides independent TDK settings options.For example, in the "Publish Document" interface, the "Other Parameters" section allows us to set the "SEO Title", "Document Keywords", and "Document Description" (usually as Description) for a single article.Similarly, document categories and single pages also have their own SEO title, keywords, and introduction fields that can be configured.

When the user visits a page, Anqi CMS will prioritize using the TDK at the content level of the page itself.If the page does not have a separately set TDK, the system will intelligently backtrack to the TDK of its category, and if the category is also not set, it will eventually fallback to the global TDK of the website.This priority mechanism ensures that each page can have a reasonable TDK, even if the operator fails to configure each one, the system can still provide basic SEO information.

精细化管理TDK in the background

To implement the dynamic call of TDK, the corresponding settings need to be made in the Anqi CMS backend first.

ForHome pageWe can navigate to the 'Home TDK Settings' module under 'Background Settings' in the background.Here, you can specify a dedicated 'home title', 'home keywords', and 'home description' for the website homepage.This information is the facade of the website, should be carefully written, highlighting the core values and business characteristics of the website.

TargetArticles, products and other documents.When we 'publish documents' or edit existing documents in 'Content Management', we can expand the 'Other Parameters' section. Here, we can find 'SEO Title' to define the page'stitleContent label, the independent "document keyword" field is used to fillkeywordswhile the "document summary" will be used by the system asdescriptionUse. If the 'Document Description' is left blank, the system will intelligently extract the first 150 characters from the document content as a description, greatly reducing the workload of content editing.

Document CategoryThe TDK settings are located in the 'Content Management' 'Document Category' editing interface, and the 'SEO Title', 'Keywords', and 'Category Description' fields can also be found in the 'Other Parameters'.These settings will be applied to all list pages under the category and will also be prioritized on the category detail page.

single pageThe TDK settings are located under 'Page Resources' in 'Page Management'.When editing any single page, the same fields such as "SEO title", "keywords", and "single page introduction" are provided to ensure that each independent page can also have a unique SEO configuration.

Dynamically call TDK information in the template

In the Anqi CMS template system, we use the powerful "Universal TDK tag"{% tdk %}To implement the dynamic acquisition and display of TDK. The intelligence of this tag lies in the fact that it can automatically obtain the most suitable TDK data without manual judgment of the current page type.usually, these tags are placed in the template file's<head>area to ensure that search engines can correctly crawl.

Page Title (Title)

The page title is one of the most important elements of SEO, we use{% tdk with name="Title" %}to obtain. This tag also supports some practical parameters to control the display of the title:

  • siteName=true: The website name will be appended to the page title, for example, "Article Title - Website Name". This is very useful for brand exposure. By default, this parameter isfalsewill not append the website name.
  • sep="_": You can customize the separator between the page title and the website name, the default is a hyphen.-.
  • showParent=true: If set on the article or category page,trueIf it will be included in the title, the parent category title will be formed to form a longer breadcrumb title, such as "Article Title - Category Title - Website Name"。
<title>{% tdk with name="Title" siteName=true sep=" | " showParent=true %}</title>

The code will dynamically generate a complete title similar to 'Current Page Title | Parent Category Title | Website Name'.

Call page keywords (Keywords)

Page keywords are mainly through<meta name="keywords">The tag display, although its SEO weight is not as good as before, is still an important part of page content summary.

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

This tag will automatically fill in the keywords set for the current page in the background.

Call page description (Description)

The page description is a snippet below the title in search engine results, crucial for attracting user clicks. We use{% tdk with name="Description" %}to call.

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

The system will prioritize using the description set for the current page in the background, if none is available, it will backtrack based on the hierarchy or automatically extract the summary content.

Call page specification link (CanonicalUrl)

The canonical URL is used to indicate the preferred version of a page to search engines, effectively avoiding duplicate content issues and is crucial for SEO.

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

Here we first assign the specification link to a variablecanonicalThen proceed{% if canonical %}Determine if it exists, only output when the specification link exists<link rel="canonical">Tag, this is a robust practice method.

The intelligent filling mechanism of TDK content

The strength of AnQi CMS lies in its intelligent TDK filling mechanism. Even if the operation personnel do not manually set SEO titles, keywords, and descriptions for each page, the system can ensure that the page has reasonable TDK information:

  • Title:If the page does not have an explicit SEO title, the system may revert to the page's own title (such as the article title, category name, single page name), and combine it with the website name to form a complete<title>.
  • Description:If the document or page has not set 'Document Description' or 'Single Page Description', the system will automatically extract the first 150 characters of the content as a description to ensure the page does not lack itdescription.
  • Keywords:If the keyword is not set, the label may be left blank or use the system default configuration.

This intelligent filling greatly reduces the workload of operation personnel while ensuring the basic integrity of the website's SEO.

Summary

Setting and calling TDK dynamically in AnQi CMS is a straightforward and powerful process. By fine-tuning the TDK configuration for the homepage, articles, categories, and single pages in the background, and combining it with the flexible template.{% tdk %}Label, we can easily achieve high-quality page TDK management.This not only helps to improve the visibility and ranking of the website in search engines, but also can attract target users through precise titles and descriptions, bringing continuous traffic and business growth to the website.As a website operator, mastering these TDK settings and calling skills will be a powerful weapon for optimizing your website SEO and enhancing the effectiveness of content marketing.


Frequently Asked Questions (FAQ)

1. If a page (such as a newly published article) does not have SEO title, keywords, and description set separately in the backend, what will be displayed on the frontend page?

AnQi CMS uses a priority backtracking mechanism to handle this situation.When a page does not explicitly set TDK, the system will try to obtain the TDK information from its category.If the category is not set either, it will fallback to the global TDK defined in the background "Home TDK Settings".For the description, if the article or single page does not set a brief introduction, the system will also intelligently extract the first 150 characters from the page content as the default description.This mechanism ensures that each page has at least a set of basic TDK, avoiding the loss of SEO elements.

2. In the template, use{% tdk %}tags and direct use{{archive.SeoTitle}}or{{category.Description}}What is the difference between calling TDK fields?

{% tdk %}The tag is a "universal" tag provided by Anqi CMS, and its main advantages lie in intelligence and versatility.It will automatically judge and obtain the most relevant TDK data according to the current page type (home page, article detail page, category list page, single page, etc.).For example, on the article detail page,{% tdk with name="Title" %}The SEO title of the article will be automatically obtained; on the category page, the SEO title of the category will be automatically obtained. And{{archive.SeoTitle}}or{{category.Description}}This variable is specific toarchiveorcategoryThe object exists and is only valid in the corresponding page context, more suitable for use within loops or specific data retrieval tags. In<head>an area, recommended for use{% tdk %}The tag, because it is more general and robust, can adapt to the acquisition needs of TDK for different page types.

3. I set the 'SEO title' for the article in the background, but on the front page of the<title>In the tag, it always adds the website name at the end of my article title, I only want to display the article title, how can I control it?

This is because{% tdk with name="Title" %}The tag may be affected by defaultsiteNameParameter effect. If you only want to display the SEO title of the article without adding the website name, you need to set it in the template.siteNameThe parameter is explicitly set tofalseFor example, use{% tdk with name="Title" siteName=false %}Additionally, you can alsosepParameter control separator (default is-), or useshowParent=falseTo avoid displaying the parent category title, thus achieving complete control over the output of the page title.

Related articles

How to obtain and display the contact information, phone number, email, WeChat, and other contact methods set in the background?

Hello, as an experienced CMS operation person in the security industry, I know that clear and convenient contact information on the website is crucial for user experience and business conversion.Today, let's discuss in detail how to configure contact information in the Anqi CMS backend and display it flexibly and accurately on various positions of the website front-end. Configure website contact information: Back-end operation guide Managing website contact information in AnQi CMS is an intuitive and powerful process.First, we need to enter the background management interface for configuration.

2025-11-06

How to call and display the name, Logo, and other system global configuration information in AnQi CMS template?

As an experienced security CMS website operations personnel, I am well aware of the importance of the global configuration information of the website, such as the website name and logo, for the unified display of the brand image and user recognition.In AnQi CMS, these core information is unifiedly managed, and through a concise and efficient template tag mechanism, it allows operators to easily call and display on various pages of the website. ### Management of website global configuration information in AnQi CMS AnQi CMS centralizes the global configuration information of the website in the "Global Function Settings" module of the background.

2025-11-06

How to implement template customization for specific categories or pages, for example `page/about.html`?

As an experienced CMS website operator, I am well aware of the importance of content presentation for user experience and Search Engine Optimization (SEO).AnQiCMS provides a powerful and flexible template customization mechanism, allowing us to create exclusive visual and functional layouts based on different content types or specific page requirements.Today, I will detail how to implement template customization for specific categories or pages in AnQiCMS, such as the needs we often encounter, such as `page/about.html`.

2025-11-06

What are the differences between the 'Folder mode' and 'Flat mode' in the template file organization pattern?

As a senior security CMS website operations personnel, I am well aware of the importance of template file organization methods for website post-maintenance, content release efficiency, and team collaboration.In AnQi CMS, the organization mode of template files is mainly divided into two types: 'folder mode' and 'flattened mode', each with its own characteristics and suitable for different project needs and team habits.Understanding the differences between these two patterns can help us better choose and manage templates.First, let's delve deeper into the **folder organization pattern**.

2025-11-06

How to display a website navigation menu and support multi-level dropdown navigation?

As an experienced CMS website operation personnel of an enterprise, I know that a well-organized and easy-to-use navigation menu is crucial for the website user experience and content discovery.AnQi CMS provides a powerful and flexible navigation management function, which can help us easily set up the main menu of the website and also support multi-level dropdown navigation to meet the needs of complex website structures. ### Backend Navigation Configuration: Build Menu Structure The setting of the navigation menu in AnQi CMS starts from the backend management interface.

2025-11-06

How to correctly generate and display breadcrumb navigation on a page?

As an experienced CMS website operation person in an enterprise, I am very clear about the importance of breadcrumb navigation in improving user experience and website SEO.It not only helps visitors clearly understand their position on the website, but also guides search engines to better understand the website's hierarchical structure.In AnQi CMS, correctly generating and displaying breadcrumb navigation is a fundamental and important content management task.

2025-11-06

How to get the classification list under a specific content model (such as articles, products)?

As an experienced CMS website operation personnel for Anqi, I know the importance of content organization and user experience for the success of the website.Accurately display content categories, not only can help users quickly find the information they are interested in, but also improve the overall SEO performance of the website.Today, we will delve into how to obtain the category list under specific content models (such as articles, products) in AnQiCMS, which is crucial for building clear website navigation, content aggregation modules, and special pages.

2025-11-06

How to retrieve detailed information for a specified category, such as the category name, description, and link?

As an experienced website content expert in AnQiCMS (AnQiCMS) operation, I fully understand the importance of classification information in building website structure and improving user experience.The Anqi CMS, with its intuitive and powerful template tag system, makes it exceptionally easy to obtain and display detailed information about categories.In order to optimize navigation, enrich page content, or improve SEO effect, accurately obtaining the category name, description, and link is an indispensable part of our daily operation.

2025-11-06