In content operation, setting the title of the website article detail page is a key link. We often encounter such situations: the content title of the article itself needs to be eye-catching, creative, to attract readers' clicks; while the page title required for search engine optimization (SEO) (i.e., the displayed in the browser tab)<title>The content of the tag), it is more focused on the layout of keywords, length control, and the friendliness to search engines.In AnQiCMS, you can fully flexibly manage these two different titles, ensuring both user experience and SEO effects without any compromise.
How to implement custom SEO title in AnQiCMS
AnQiCMS fully considered the needs of SEO optimization and provided an independent "SEO title" field for each article.This means you can set a title for the article to be displayed to readers, as well as a separate SEO title for search engine inclusion and display.
When you edit or publish an article, just pay attention to the 'Other Parameters' collapse area at the bottom of the page.Expand this area, and you will see an input box named "SEO Title".This field is exactly where AnQiCMS customizes the SEO title settings for your article detail page.Enter a carefully optimized title that will be used when the page is indexed by search engines as<title>The content of the tag, while the "Document Title" you set at the top of the article will be as the page content in<h1>the title for users to read.
Call custom SEO title in template
To correctly display this custom SEO title in the article detail page's HTML header, we need to use the powerful template tags provided by AnQiCMS. Usually, the template file for the article detail page would be{模型table}/detail.htmlOr you can specify a custom template for this article in the background.
AnQiCMS provides a namedtdktag, used specifically to manage the page.title/descriptionandkeywordsThese SEO core elements. UsetdkThe tag calls the SEO title very intuitively:
<title>{% tdk with name="Title" %}</title>
This code will intelligently retrieve the SEO title of the current article.If you enter content in the "SEO Title" field of the article, it will display your custom SEO title first;If not filled in, the system will fallback to using the document title itself, or other preset TDK logic, to ensure that the page always has a valid title.
Furthermore,tdkTags also provide flexible parameters, allowing you to better control the display of the title. For example, automatically adding your website name at the end of the SEO title is very helpful for brand exposure and recognition:
<title>{% tdk with name="Title" siteName=true %}</title>
tositeNamethe parameter totrueYour page title will automatically be added after the SEO title, usually followed by a hyphen-separated (default separator). If you want to change the separator, you can usesepparameters:
<title>{% tdk with name="Title" siteName=true sep="_" %}</title>
So, your SEO title and website name will be separated by an underscore_Make a connection.
In addition to the SEO title, we strongly recommend that you also go throughtdkThe tag is inheadRegional introduction article keywords and descriptions, this information can also be set in the "Other parameters" on the article editing page:
<meta name="keywords" content="{% tdk with name="Keywords" %}">
<meta name="description" content="{% tdk with name="Description" %}">
Complete example
Integrate the above template code snippet into your article detail pageHTMLof<head>Part, the header structure of a typical article detail page may look like this:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
{# 使用tdk标签动态生成SEO标题,并自动带上网站名称,以短横线分隔 #}
<title>{% tdk with name="Title" siteName=true sep=" - " %}</title>
{# 使用tdk标签动态生成页面关键词 #}
<meta name="keywords" content="{% tdk with name="Keywords" %}">
{# 使用tdk标签动态生成页面描述 #}
<meta name="description" content="{% tdk with name="Description" %}">
{# 引入CSS样式文件,这里使用的是系统提供的模板静态文件地址标签 #}
<link rel="stylesheet" href="{% system with name="TemplateUrl" %}/css/style.css">
{# 可以在此处添加其他SEO优化标签,如canonical链接等 #}
{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}
{# 网站的实际文章标题,通常作为页面内容的核心H1标签 #}
</head>
<body>
<article>
<h1>{% archiveDetail with name="Title" %}</h1> {# 这里的Title是文章的原始标题,用于内容展示 #}
{# 接下来是文章正文内容,可以使用 archiveDetail 的 Content 字段 #}
<div>
{% archiveDetail articleContent with name="Content" %}
{{ articleContent|safe }}
</div>
{# 其他文章详情元素,如发布时间、作者等 #}
</article>
{# 页面底部内容 #}
</body>
</html>
With the above configuration, your security CMS article detail page can achieve search engine-friendly custom SEO titles, while maintaining the reading attractiveness of the article itself, bringing better effects to your content operation.
Frequently Asked Questions (FAQ)
Why is my article detail page
<title>Why is the tag still showing the article title instead of the SEO title?This is usually due to two reasons: one, you may have forgotten to fill in the 'SEO Title' field in the 'Other Parameters' on the article editing page; two, your template file (usually{模型table}/detail.htmlOr a custom template is not used{% tdk with name="Title" %}Use the tag to call the SEO title. Please check these two places to ensure that the SEO title has been set and the template calling method is correct.Is there a limit to the number of characters in a custom SEO title?AnQiCMS system itself does not have a strict word limit for SEO titles, but in order to achieve the best search engine display effect and user experience, we strongly recommend that you control the SEO title within the limit of **60-70 characters (about 30-35 Chinese characters)within. A long title may be truncated on the search results page, affecting the delivery of complete information.
Can't categories and single pages also be set with custom SEO titles?Yes, AnQiCMS also supports setting custom SEO titles for categories and single pages. When editing categories or single pages, you will find similar 'other parameters' or direct 'SEO title' fields, where you can fill in the content, and then use it in the corresponding category list page or single page detail page template.
{% tdk with name="Title" %}Call the tag. This ensures that all key pages of your website's SEO titles can be managed in fine detail.