How to configure the separator (`sep`) and whether to display the parent category title (`showParent`) for the `tdk` filter in Anqin CMS?

Calendar 👁️ 61

During website operation and SEO optimization, the page title (Title) is a key element to attract user clicks and improve search engine rankings. AnQiCMS provides flexibletdkFilter, allowing us to finely control the display of page TDK (Title, Description, Keywords). Among them,sepandshowParentThese two parameters play an important role in constructing page titles with hierarchy and clarity.

Next, we will delve deeper into how to configure in AnQiCMS.tdkof the filtersep(Separator) andshowParent(Parameter for whether to display the parent category title).

UnderstandingtdkFilter and its importance

tdkThe filter is a very practical template tag in AnQiCMS, mainly used to output the page title (Title), keywords (Keywords), and description (Description) and other SEO meta information.Using it correctly can help the website content be better understood and displayed by search engines.Generally, we would be on the page HTML's<head>The region uses it to dynamically generate these tags.

For example, a basic title output might look like this:

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

This will automatically output the title based on the type of the current page (such as articles, categories, single pages, etc.). But sometimes, we need more personalized or informative titles, at that timesepandshowParentit comes in handy.

ConfigurationsepParameter: Custom title separator

sepThe parameter allows us to customize the separator between the various components of the page title. AnQiCMS uses a hyphen by default (-)as a separator for parts of the title. However, depending on the design style or SEO strategy, you may want to use other symbols, such as a vertical line (|)、an underscore (_Or space and so on.

Assuming your website name is "AnQiCMS", the title of an article page is "AnQiCMS Function Details", if the website name is set to be displayed at the same time, it may be displayed by default as: "AnQiCMS Function Details - AnQiCMS". If you want to change the separator to a vertical bar, you can configure it like this:

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

Thus, the page title will be changed to: "AnQiCMS Feature Explanation | AnQiCMS". Simply modifysepThe value, you can easily adjust the visual effect of the title to make it more consistent with your brand image or reading habits.

Remember,sepParameters are onlytdkThe filter is used to output the page title (i.e.name="Title"It is valid only when

ConfigurationshowParentParameter: Display parent category title

showParentThe parameter is a feature very suitable for websites that need to emphasize the content hierarchy structure, such as product detail pages on e-commerce websites or article pages on knowledge base websites. When this parameter is set totrueWhen, AnQiCMS will not only display the title of the current content in the page title, but also show the titles of the parent category (and even the grandparent category) it belongs to.

By default,showParentThe value of the parameter isfalseIt means that the page title only displays the title of the current content and does not automatically include the parent category information.

For example, you have a product “Latest Smartphone”, which belongs to the “Phone” category, and the “Phone” category belongs to the “Electronics” major category. If you want to display the complete hierarchical title on the product page, you can configure it like this:

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

If your website name is "AnQi Mall", then the product page title may be displayed as: "Latest Smartphone - Phone - Electronic Products - AnQi Mall".

This title structure allows users to clearly understand the position of the current content on the website, and it also provides richer contextual information for search engines, which helps to improve the ranking of relevant keywords. Similarly,showParentParameters also only apply toname="Title"the situation.

Integrate and practice with **practical applications

In practical applications,sepandshowParentParameters are often combined to create a title that is both aesthetically pleasing and SEO-friendly.

A typical example is:

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

This may generate a title format like 'Article Title_Category Title_Top Category Title_Website Name'.

When configuring these parameters, consider the following points:

  • SEO friendliness:Keep the title concise and clear, placing the most important keywords at the front of the title.showParentAlthough it increases the amount of information, it may also lead to a long title, which needs to be weighed.
  • User Experience:The title should be easy to read and understand, accurately conveying the content of the page.
  • Brand consistency: Choose a consistent delimiter style and apply it to the entire website to maintain the professionalism and consistency of the titles.
  • Testing and adjustment:After configuration is complete, be sure to test on different types of pages (such as article detail pages, category list pages, single pages, etc.), check if the title display meets expectations, and adjust according to search engine performance and user feedback.

By flexibly using AnQiCMS'stdkin the filtersepandshowParentParameter, you can better control the page title of the website, laying a solid foundation for your content operation and SEO optimization.


Frequently Asked Questions (FAQ)

Q1: Why did I set up on my page.showParent=trueBut the parent category is not displayed in the title?A1: Check if the current page belongs to a clear category.showParentThe parameter is only valid in documents (such as articles, products) or subcategory pages, and this content must be correctly categorized under at least one parent category.If the page is a single page or content without an assigned category, this parameter will have no effect.Moreover, ensure that you arename="Title"oftdkThe tag is set.showParent.

Q2: ChangeseporshowParentAfter the parameter, what do I need to do to make the website front-end display update?A2: Changes to template tags in AnQiCMS usually take effect immediately.But to ensure the page is completely refreshed and to clear any cache that may exist in the browser, you can try to clear the system cache of AnQiCMS backend (usually found in the "Update Cache" feature), and then force refresh your browser (such as Ctrl+F5).If the website uses a CDN, it may also need to refresh the CDN cache.

Q3:sepandshowParentWill the parameter affect the page URL or content itself?A3: No.sepandshowParentThe parameter only affects the page HTML.<title>The display format of the label. It does not change the actual URL address of the page, nor does it modify the main content of the page.These parameters are purely used for SEO and user interface display of metadata configuration.

Related articles

How to concatenate the article title (Title) with the system-defined website name (SiteName) through the `tdk` filter and output it to the <title> tag in the Anqi CMS template?

In website operation, the importance of the `<title>` tag is self-evident. It is not only the key for search engines to understand the theme of the page, but also the content that users see first in the search results.A well-crafted page title that can effectively increase click-through rates and have a positive impact on SEO optimization.Therefore, how to organically integrate the core title of the article with the brand name of the website to form an accurate and attractive `<title>` tag is a fundamental and important link in the design of website templates.AnQiCMS as a feature-rich enterprise-level content management system

2025-11-08

The `dump` filter has what practices in debugging Anqi CMS templates, and how to clearly view the structure and value of complex variables?

During the template development process of AnQi CMS, we often encounter the need to view variable content and structure, especially when dealing with complex objects passed from the background.If you cannot clearly know what is inside the variable, debugging will be as difficult as a blind man feeling an elephant.The AnqiCMS adopts the Pongo2 template engine syntax similar to Django, providing rich tags and filters to help us build dynamic pages, one extremely powerful debugging tool is the `dump` filter.### `dump` filter

2025-11-08

How to safely output HTML code passed from the backend in Anqi CMS template using the `safe` filter without escaping?

Build and manage websites in AnQi CMS, we often make good use of its powerful and flexible template system to present colorful content.The template engine of AnQi CMS has adopted the syntax of Django templates, which brings us a familiar development experience and powerful features.However, when handling HTML code passed from the backend to the frontend, we encounter an important security mechanism: **automatic escaping**.

2025-11-08

How to automatically identify URLs and email addresses in the text and convert them into clickable links in `urlize` and `urlizetrunc` filters in AnQi CMS?

In Anqi CMS, we often encounter scenarios where we need to display website or email addresses in the article content, comments, or other user input text.If these addresses are only plain text, users will not be able to click and jump directly, which will greatly reduce the user experience of the website.Fortunately, Anqi CMS is built-in with powerful template filters, among which `urlize` and `urlizetrunc` are specifically designed to solve this problem. They can automatically convert identified URLs and email addresses into clickable HTML links.

2025-11-08

How to use the `stringformat` filter in Anqi CMS template to format price numbers as currency (such as “¥%.2f”)?

When displaying product or service prices on a website, we all hope that they look clear and professional, easy to understand.A sequence of price numbers without currency symbols and inconsistent decimal places, which not only affects the appearance but may also raise doubts about the professionalism of the product. 幸运的是,AnQiCMS(AnQiCMS)强大的模板引擎提供了多种实用的过滤器,其中 `stringformat` 过滤器就是将数字格式化为标准货币形式的利器。

2025-11-08

How does the `stringformat` filter handle null or invalid input in AnQi CMS, will it return an error or a default value?

In Anqi CMS template design, we often encounter scenarios where we need to format variable output.At this point, the `stringformat` filter is particularly important, as it helps us clearly display numbers, strings, and even other types of data according to the format we preset.However, when using such tools, a common and crucial question is: how will `stringformat` handle it when the variable itself is null or invalid?Is it a direct error that causes the page to crash, or is there a more elegant default behavior?

2025-11-08

How to safely handle user input that may contain JS code in the comment or message form of Anqi CMS using the `escapejs` filter?

In website operation, the comment area and message board are important channels for interacting with users and collecting feedback.However, this area where users can freely enter content is often an entry point for potential security risks, especially cross-site scripting (XSS) attacks.As website administrators, we must ensure that the content entered by users is safe when displayed on the frontend and is not exploited maliciously.The Anqi CMS, a system focused on providing secure and efficient content management solutions, has provided us with powerful tools to meet such challenges. Today

2025-11-08

Can the `stringformat` filter convert a Go language slice or Map into a readable JSON string output?

When developing templates for AnQiCMS, we often encounter such questions: The background data is a slice (Slice) or map (Map) structure in Go language, and if we want to output these data in a readable JSON string format in the front-end template, can the `stringformat` filter built into AnQiCMS handle it?This is indeed a very practical requirement, after all, JSON format is ubiquitous in modern web development.

2025-11-08