How to dynamically generate the SEO title, keywords, and description of the current page and support the website name suffix?

Calendar 👁️ 73

As a senior content management expert who deeply understands the operation of AnQiCMS, I am well aware of the importance of search engine optimization (SEO) for website traffic and user retention.The website's SEO title, keywords, and description (usually abbreviated as TDK) are key factors for search engines to understand page content and for users to decide whether to click.AnQiCMS provides a powerful and flexible mechanism that allows us to dynamically generate these important SEO elements and easily integrate the website name as a suffix to enhance brand awareness.

The foundation of dynamic TDK: AnQiCMS TDK tags

The key to implementing dynamic page TDK generation in AnQiCMS lies in its powerfultdkLabel.This tag is designed to intelligently aggregate the SEO information of the current page and display it according to our needs.tdkTags can prioritize the most relevant SEO data based on the current context, ensuring that your page always appears in the most optimized state in search engines.

Dynamic generation of SEO titles and appending the website name

Page'stitleTags are the most important for SEO. Through AnQiCMS'stdkLabel, we can easily implement dynamic title generation and optionally add the website name as a suffix to enhance brand effect.

In your template file (usuallybase.htmlOr the page<head>You can use the following code to dynamically retrieve the title of the current page:

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

This code will automatically extract the most suitable title based on the type of the current page and the configured SEO information. For example:

  • HomeIt will read the 'Background Settings' -> 'Home TDK Settings' configured 'Home Title'.
  • Article detail pageIt will read the value of the "SEO title" field in the "Publish document" interface "Other parameters"; if the field is empty, it usually falls back to the article title.
  • Category list pageIt will read the value of the 'SEO Title' field in the 'Document Category' interface under 'Other Parameters'; if it is empty, it will usually fall back to the category name.
  • single pageIt will read the value of the 'SEO Title' field in the 'Page Management' interface of the single page; if it is empty, it will fallback to the page name.
  • Tag detail pageIt will read the value of the field 'SEO Title' in the 'Document Tags' interface of the label; if it is empty, it will fallback to the label name.

To automatically add the website name as a suffix after the title, you just need to intdkadd in thesiteName=trueattribute:

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

At this time, AnQiCMS will automatically extract the value from the "Website Name" configured in the "Background Settings" -u003e "Global Settings" and concatenate it with a hyphen-The default is a hyphen, or it can also besepcustom property separator, such assep="_"The format is appended to the page title.For example, if the page title is "AnQiCMS Getting Started Guide", and the website name is "AnQiCMS", the final title displayed will be "AnQiCMS Getting Started Guide - AnQiCMS".

In addition, for hierarchical content such as category list pages,tdkTags also supportshowParent=trueAttribute, allows the title to display the parent category name, further enhancing the descriptiveness and SEO effect of the title.

Dynamically generate SEO keywords

The page's keywords (Keywords) although their weight has decreased in modern search engines, are still one of the signals of the page content. Proper keyword configuration helps search engines better understand the theme of the page.

In AnQiCMS, you can dynamically generate the Keywords for the page in the following way:

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

tdkTags will intelligently retrieve keywords from the following levels:

  • HomeRead the "Background Settings" -> "Home TDK Settings" configured "Home Keywords".
  • Article detail pageRead the value of the "Document Keywords" field on the "Publish Document" interface of the article.
  • Category list page: Read the value of the 'Keywords' field in the 'Other Parameters' section of the 'Document Classification' interface.
  • single page: Read the value of the 'Keywords' field in the 'Page Management' interface of the single page.
  • Tag detail pageRead the value of the "Tag Keywords" field in the "Document Tag" interface.

If a specific page does not have a keyword set, the system will try to trace up or revert to the preset keywords in the global settings to ensure that each page has basic keyword information.

Dynamic SEO Description Generation

The description (Description) is a brief summary below the title in search engine results, and it is an important copy to attract users to click.A well-written description that accurately summarizes the page content and includes relevant keywords.

In AnQiCMS, the page description can be dynamically generated as follows:

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

tdkTags will be retrieved in the following priority for description content:

  • Home: Read the description configured in the "Home TDK Settings" under "Background Settings".
  • Article detail pageRead the value of the "Document Summary" field in the "Publish Document" interface; if the field is empty, the system will automatically extract the first 150 characters of the document content as a description.
  • Category list page: Read the value of the 'Category Description' field in the 'Document Category' interface.
  • single page: Read the value of the 'Single Page Description' field in the 'Page Management' interface.
  • Tag detail page: Read the value of the field "Label Introduction" in the "Document Label" interface.

By means of this hierarchical acquisition mechanism, AnQiCMS ensures the dynamics and relevance of the described content, reduces the cost of manual maintenance, and improves the overall SEO performance of the website.

Summary and **practice**

Place the abovetdklabel in the website template of<head>The area is**practice.The dynamic TDK generation function of AnQiCMS greatly simplifies SEO work, allowing you to focus on content creation while maintaining the competitiveness of your website in search engines.

As an operations manager, I recommend that you:

  • Make full use of the background configuration fields:As much as possible, set exclusive SEO titles, keywords, and descriptions for each article, category, single page, and tag page.These page-level settings take precedence over global settings, providing more precise optimization.
  • Keep the website name consistentFill in the 'Global Settings' accurately with the 'Website Name' to ensure it is displayed correctly in all page title suffixes, maintaining brand consistency.
  • Focus on content qualityDynamic TDK is just a tool, high-quality and valuable content is the root of attracting users and search engines.
  • Regular monitoring and adjustment:Using AnQiCMS built-in traffic statistics and crawler monitoring features, analyze the effect of TDK settings, and optimize according to data feedback.

By these detailed configurations and practices, your AnQiCMS website will achieve better visibility in search engines and attract more target users.


Frequently Asked Questions (FAQ)

Question 1: If I have not set SEO titles, keywords, and descriptions for a specific article, category, or single page, how will AnQiCMS handle it?

Answer: AnQiCMS has designed a complete priority fallback mechanism.If you have not set these SEO elements for a specific page, the system will try to inherit them from the parent level (such as categories), and eventually revert to the global default values configured in the "Background Settings" -> "Home TDK Settings" to ensure that each page has at least basic SEO information and to avoid missing page TDKs.If the description is not manually filled in, the system will also try to automatically extract a paragraph from the page content as an introduction.

Question 2: Can the separator of the suffix in the dynamically generated SEO title of the website be modified?

Yes, you can. When using{% tdk with name="Title" siteName=true %}tags, you can addsepSpecify a custom delimiter. For example, if you want to use an underscore as a delimiter, you can set it like this: {% tdk with name="Title" siteName=true sep="_" %}This will display as "Page Title_Website Name" between the page title and the website name.

Question 3: Besides SEO title, keywords, and description, what dynamic tags related to SEO does AnQiCMS support?

Answer: AnQiCMS offers various advanced SEO tools and related tags. For example,tdkTags also support dynamically generated page canonical links (CanonicalUrl), which is crucial for avoiding duplicate content issues. You can use{% tdk with name="CanonicalUrl" %}Get it.In addition, the system also has features such as Sitemap generation, Robots.txt configuration, pseudo-static rule management, and assists in the overall SEO strategy of the website through corresponding tags or backend settings.

Related articles

How to call and display the contact information (such as phone, email, social media) configured in the AnQiCMS template?

As a senior content worker who deeply understands the operation of Anqi CMS, I know the importance of displaying the contact information of the enterprise externally.This not only concerns whether customers can conveniently contact you, but also is the basis for building trust and promoting business cooperation.AnQi CMS provides a直观 and flexible solution for website operators, allowing you to easily manage and display various contact information without writing complex code.

2025-11-06

How to get and display the global configuration information (such as name, Logo) of AnQiCMS template?

As an experienced website operator proficient in AnQiCMS, I know that efficiently and accurately obtaining and displaying the global configuration information of the website is crucial for website maintenance, brand consistency, and user experience.AnQiCMS provides intuitive and powerful template tags, making it easy to achieve this goal.In AnQiCMS template, obtain and display the global configuration information of the website, such as the website name, Logo, filing number, etc., mainly depending on the built-in `system` tag

2025-11-06

How to specify an independent template file for a specific category, article, or single page in AnQiCMS?

As a deep user of Anqi CMS website operators, I know that the flexibility of content display is crucial for attracting and retaining users.Strong support is provided by Anqicms in this aspect, allowing us to specify exclusive template files for specific categories, articles, even independent pages, thereby achieving highly customized content presentation.This not only helps to improve the user experience, but also provides great convenience for our refined operation and SEO optimization.

2025-11-06

How to customize the directory structure and file naming rules of AnQiCMS templates?

Hello, as a senior operator of AnQiCMS, I am very happy to be able to elaborate in detail on how to customize the directory structure and file naming rules of AnQiCMS templates.Understanding these basics is the key to efficient management and optimization of website content. ### AnQiCMS Template Custom Overview AnQiCMS is an enterprise-level content management system based on the Go language, which provides high flexibility in template customization.It uses a syntax similar to the Django template engine, making it easy for front-end developers to get started.

2025-11-06

How to implement dynamic breadcrumb navigation in AnQiCMS template and customize the home page text?

As a senior security CMS website operator, I know that high-quality content and excellent user experience are the foundation of website success.With the powerful functions of AnQiCMS, we can not only efficiently manage content, but also provide users with a smooth and intuitive browsing experience through fine-tuned template customization.Today, let's delve deeply into how to implement dynamic breadcrumb navigation in the AnQiCMS template, and flexibly customize the home page text to enhance the usability and search engine friendliness of the website.

2025-11-06

How to use the `categoryList` tag to get and loop through the category list under a specified content model?

As an expert who has been deeply engaged in AnQiCMS content operations for a long time, I know the importance of the category list in website structure and user experience.Make flexible use of the `categoryList` tag, which can help us efficiently organize content, build a clear navigation system, and provide readers with a more accurate content discovery path.Below, I will elaborate on how to use the `categoryList` tag to retrieve and display the category list of a specified content model in a loop.## Use AnQiCMS's `categoryList`

2025-11-06

How to get the details of the current access category, including the title, link, description, and custom fields?

As an experienced CMS website operator, I am well aware of the importance of high-quality and easily accessible content information for website user experience and search engine optimization.In Anqi CMS, obtaining detailed information about the current visited category is a very basic and frequent requirement in website construction. Whether it is used for page titles, navigation breadcrumbs, or detailed introductions on category pages, it is necessary to accurately call these data.Our AnQi CMS provides a powerful and flexible template tag system, making it extremely easy to obtain the title, link, description, and even custom fields of the current visited category

2025-11-06

How to get the list of all single pages or the detailed content of a specific single page in AnQiCMS template?

As a senior security CMS website operator, I am well aware of the importance of high-quality, well-structured content for website user experience and search engine optimization.A single page is the core of a website's basic information display, such as "About Us", "Contact Information", and "Terms of Service", etc.In AnQiCMS, through the powerful template tag system, we can flexibly obtain and display the content of these single pages. I will elaborate in detail on how to obtain the list of all single pages and the detailed content of a specific single page in the AnQiCMS template.###

2025-11-06