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:
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.
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".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.
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