When creating a new page, there's a "Promote" tab. Under the "for search engines" section there's a "title tag" and a "meta description" value. As I understand, the "title tag" sets the document's title and the "meta description" sets the document's meta description. But how would I actually use these values in my page template?
I searched far and wide, but it seems that Wagtail's documentation explains nothing about the Promote tab or what purpose it serves. Are the values defined there available as template variables? How would I actually access a page's "title tag" or "meta description"?
CodePudding user response:
These fields are documented very briefly here. They are just fields on the base Page
model - so any model that inherits from that will have these fields, which you can access like any other fields on the model:
seo_title
: Alternate SEO-crafted title, for use in the page’s<title>
HTML tag.
It's up to you whether you use this in your template - if you do, it would be in the HTML head
section, e.g.,
<title>{{ page.seo_title }}</title>
search_description
: SEO-crafted description of the content, used for search indexing. This is also suitable for the page’s<meta name="description">
HTML tag.
Again up to you whether you use it - e.g., in the head
section:
<meta name="description" content="{{ page.search_description }}">