How to get the website name in Anqi CMS template and correctly concatenate it in the SEO title?

Calendar 👁️ 70

In website operation, a well-constructed SEO title is the key to attracting user clicks and improving search engine rankings.It must not only accurately summarize the page content but also skillfully integrate the brand information.For AnQiCMS users, how to dynamically obtain the website name and correctly concatenate it into the SEO title is a practical and efficient skill.

AnQiCMS as a content management system focusing on SEO optimization provides very flexible tags at the template level, allowing you to easily achieve this goal.It is not like some traditional systems that require complex programming, but can be completed through concise template syntax.

Understanding the TDK mechanism of AnQi CMS

In AnQiCMS, the 'TDK' (Title, Description, Keywords) is the core SEO configuration item.The system provides independent TDK settings for home pages, articles, products, and category pages to facilitate refined optimization.When you visit these pages, AnQiCMS will automatically generate or obtain the corresponding TDK content based on the type of the page and the backend settings.

Get website name in the template

To integrate the website name into the SEO title, you first need to know how to obtain this name in the template. AnQiCMS provides a special system setting tag for this——system. This tag helps you get the system information configured in the background "Global Function Settings", including our website name.

If you want to display the website name anywhere on the page, such as in the footer copyright information, you can use it like this:

<div>欢迎访问:{% system with name="SiteName" %}</div>

HereSiteNameThat is the website name you entered in the "Global Function Settings" in the background.In this way, no matter how the background modifies the website name, the front-end page can be updated in real time, avoiding the trouble of manually modifying the template.

Concatenate the website name correctly in the SEO title

Since we have mastered how to obtain the website name, the next step is how to integrate it cleverly into the pagetitleWithin the tag, to form a search engine-friendly SEO title. AnQiCMS provides a 'Universal TDK tag'—tdkIt can intelligently obtain the most suitable title, keywords, and description according to the current page type.

ThistdkTags are particularly powerful when dealing with page titles.It can not only obtain the main title of the current page (such as article title, category name), but also built-in the function of directly concatenating the website name, and allows you to customize the delimiter for concatenation.

The following are some inbase.html(This is usually the template file inherited by all pages of the website) the common way to set SEO titles:

  1. Only display the main title of the page:If you want the page's<title>The tag only displays the main title of the current page (such as the SEO title of the article, the name of the category), and it can be used in this waytdkTags:

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

    In this case, if the current page is the article detail page and you have set the 'SEO title' while editing the article, then this will display the 'SEO title' you have set; if not set, it will display the article title.

  2. Page title + Website name (default separator):To better showcase the brand and optimize SEO, we usually append the website name to the page title.tdkTags provide a very convenient parameter for thissiteName=true:

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

    In this way, your page title will automatically be concatenated to “Page Main Title - Website Name” (the default separator is-)。For example, an article named "AnQiCMS Template Making Guide" may be displayed as "AnQiCMS Template Making Guide - AnQi CMS".

  3. Page title + Website name (custom separator):If you do not like the default connector or want to use another symbol (such as|/_etc.),tdkLabels also providedsepParameter custom separator:

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

    Now, your page title will display as 'Page Main Title | Website Name'. Choose a clear and beautiful delimiter to make your title more attractive in search results.

  4. Display the parent category title (article or category page):Under certain content structures, you may want the article title to include not only the name of the website but also reflect its parent category to enhance contextual information.tdklabel'sshowParent=trueThe parameter can achieve this:

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

    Such, a title of an article might be "Article Title | Parent Category | Website Name", which is helpful in maintaining information richness and SEO.

Practice and **recommendations

As a rule, thesetdkTags are placed in the public header files of the website template, for examplebase.htmlof<head>Within the area. The intelligence of AnQiCMS lies in the fact that, regardless of whether you are visiting the article detail page, category list page, or single page, thistdkTags can automatically identify the type of the current page, and give priority to the 'SEO title' set in the background or the default title of the page, then concatenate it according to your configuration (whether to concatenate the website name, and use what kind of separator).

exceptTitle,tdkTags are also used to retrieveKeywordsandDescription:

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

This makes the SEO settings of the website very concentrated and efficient.You just need to maintain the website name and TDK information of each page in the background, and the template can automatically present the title structure that conforms to the SEO**practice.

By these flexible tags, AnQiCMS allows website content operators to focus on the content itself and SEO strategies, rather than being bothered by complex template code.It provides a set of concise and powerful tools to ensure that your website has good visibility and brand recognition in search engines.


Frequently Asked Questions (FAQ)

1. Can I not display the website name on some specific pages and display it on others?Of course you can.tdklabel'ssiteNameThe parameter only takes effect at the place where you are currently calling. If you arebase.htmlSet in ChinesesiteName=trueBut a specific page (such asindex.htmlorarticle_detail.html) does not want to display the website name, you can rewrite it in the template file of the page<title>tag, and explicitly setsiteNameis set tofalseor do not use it directlysiteNameParameters. For example:

{# 在特定页面的模板文件内 #}
{% extends 'base.html' %}
{% block title %}
    <title>{% tdk with name="Title" siteName=false %}</title>
{% endblock %}

2. If I fill in the 'SEO Title' when editing articles in the background, will it take precedence over the title of the article itself?Yes. AnQiCMS'tdkThe tag will intelligently prioritize reading the "SEO Title" field you explicitly set in the backend editing interface of the corresponding page (such as articles, categories, single pages) when retrieving the page title.If you do not fill in the "SEO title", it will fallback to using the default page title (such as article title, category name).This priority mechanism ensures that you can fine-tune the SEO title for each page.

3.tdkTags can still retrieve which page information related to SEO?exceptTitle/KeywordsandDescription,tdkTags can also retrieve the page'sCanonicalUrl(规范链接),this is very useful for handling duplicate content or specifying a preferred URL. You canbase.htmlof<head>This is how to call it in the region: “`twig {%- tdk canonical with name=“CanonicalUrl” %} {%- if

Related articles

How to get the category description with a specified ID in Anqi CMS template and truncate it?

In the Anqi CMS template, effectively managing and displaying category descriptions is a common requirement.Especially when displayed on list pages or block displays, we often need to show a concise introduction of the category rather than a full-length description.This article will provide a detailed introduction on how to obtain the specified ID category description in Anqi CMS template and perform appropriate truncation processing to ensure that the content is both concise and beautiful.Get category description by specified ID In AnQi CMS template, getting category details mainly depends on the `categoryDetail` tag

2025-11-08

How to remove leading or trailing non-visible characters from the string data obtained from the content acquisition module in the template?

When using AnQi CMS for website content operations, the content collection module is undoubtedly an important way to obtain a large amount of information and quickly enrich the website content.However, text data collected or imported from external sources often contains unnecessary leading or trailing spaces, newline characters, or even other invisible characters.These seemingly minor 'dirty data' can affect the aesthetics of page layout, content alignment, and even cause subtle negative impacts on search engine optimization (SEO).

2025-11-08

How to automatically remove leading and trailing newline and tab characters from the `Description` field when the template is output?

In website content operation, the importance of the `Description` field on the page is self-evident.It is not only one of the key pieces of information that search engines use to crawl and understand page content, but also a window for users to initially understand the theme of the page in search results.A clear, concise, and non-redundant description that can effectively improve click-through rate and have a direct impact on SEO performance.However, in actual operation, we sometimes find that even though the page description is carefully written in the background, when it is output in the front-end template

2025-11-08

How to delete multiple specified character sets from both ends of a string in AnQiCMS template, for example, `()` or `[]` and other brackets?

In the AnQiCMS template, flexible string processing is an important aspect for improving content display effects and data accuracy.We often encounter the need to remove a specific character set from both ends of a string, for example, when fetching titles or tags from a database, they may be enclosed in `()` or `[]` or even `<>` brackets, and these brackets may not be needed when displayed on the front end.luckyly, AnQiCMS is developed based on Go language, its template engine adopts the template syntax of Django, and provides powerful filter functions

2025-11-08

How to get the friend link in Anqi CMS template and set the nofollow attribute?

In website operation, friendship links are an important means to enhance website authority and obtain external traffic.However, not all friendship links should pass on weight. It is particularly important to use the `rel="nofollow"` attribute reasonably to better manage the SEO performance of the website.The `nofollow` attribute tells search engines not to pass ranking weight from the current page to the target page, which is very useful when linking to non-core content, advertising pages, or third-party websites that cannot be fully trusted, and can effectively avoid SEO risks caused by low-quality links

2025-11-08

How to perform initial arithmetic operations on user input data in AnQi CMS template?

In AnQiCMS template design, performing preliminary arithmetic operations on user input data is a key link in achieving dynamic content display and interactive logic.AnQiCMS powerful template engine, draws on the characteristics of Go language and Django templates, providing developers with flexible and easy-to-understand arithmetic calculation capabilities, allowing you to handle various numerical logic in front-end templates without writing complex backend code.

2025-11-08

How to use if/else condition judgment to control content display in Anqi CMS template?

In AnQi CMS template creation, flexibly controlling the display of content is the key to improving website user experience and management efficiency.Whether it is to display specific information based on different conditions, or to implement more complex personalized layouts, conditional judgment is an indispensable tool.Today, we will delve into how to use the powerful `if/else` conditional judgment in Anqi CMS templates to accurately control the presentation of content. The template engine of AnQi CMS adopts syntax similar to Django template syntax, which allows web developers familiar with web development to quickly get started. Among them

2025-11-08

How to use a for loop to traverse an array and handle an empty array in Anqi CMS template

During the template development process of AnQi CMS, dynamic data display is one of the core requirements.No matter whether it is an article list, product display, or navigation menu, we cannot do without traversing array or collection data.How to elegantly handle empty data in this process, ensuring the beauty of the page and user experience is equally important.The AnQi CMS template engine supports powerful features similar to Django template syntax, among which the `for` loop is a powerful tool for handling data lists.

2025-11-08