Description: Used to obtain the title, keywords, and description information of the page
Usage:{% tdk 变量名称 with name="字段名称" %}The variable name is not required. After setting the variable name, it can be called by the variable name later. If the variable name is not set, it is output directly.
Parameters supported by tdk
- Whether to display the website name
siteNamesiteNameDefault valuesiteName=falseOnly whenname="Title"it is effective.
name parameters available fields are:
- Page title
Title - Page keywords
Keywords - Page Description
Description - The specification link of the page
CanonicalUrl
Page titleTitle
Label usage:{% tdk with name="Title" %}The variable supports when name=“Title”
siteNameThe attribute can be set to whether the website name is appended to the Title.siteNameIt is a bool type, default is not displayed. Display it using:{% tdk with name="Title" siteName=true %}sepProperty, can set the separator, default is-showParentProperty, can set whether to display the title of the parent category, default isshowParent=falseOnly whenname="Title"only takes effect when it is.
{# 不显示网站名称后缀 #}
<title>{% tdk with name="Title" %}</title>
{# 显示网站名称后缀 #}
<title>{% tdk with name="Title" siteName=true %}</title>
{# 不显示网站名称后缀 #}
<title>{% tdk with name="Title" siteName=false %}</title>
{# 自定义名称调用 #}
<title>{% tdk seoTitle with name="Title" siteName=true %}{{seoTitle}}</title>
{# 自定义分隔符 #}
<title>{% tdk with name="Title" sep="_" %}</title>
{# 显示上级分类标题 #}
<title>{% tdk with name="Title" showParent=true %}</title>
Page keywordsKeywords
Label usage:{% tdk with name="Keywords" %}
{# 默认用法 #}
<meta name="keywords" content="{% tdk with name="Keywords" %}">
{# 自定义名称调用 #}
<meta name="keywords" content="{% tdk seoKeywords with name="Keywords" %}{{seoKeywords}}">
Page DescriptionDescription
Label usage:{% tdk with name="Description" %}
{# 默认用法 #}
<meta name="description" content="{% tdk with name="Description" %}">
{# 自定义名称调用 #}
<meta name="description" content="{% tdk seoDescription with name="Description" %}{{seoDescription}}">
The specification link of the pageCanonicalUrl
Label usage:{% tdk with name="CanonicalUrl" %}
{# 默认用法 #}
<link rel="canonical" href="{% tdk with name="CanonicalUrl" %}" />
Generally, CanonicalUrl needs to be checked for existence before setting
{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}