Templating
Metadata defined in templates gets the highest priority when metadata is processed.
The sprout.meta.update
variable allows you to override metadata within templates. The sprout.meta.update
variable must use the do
tag syntax.
A Simple Page
page.twig
twig
{% do sprout.meta.update({
title: entry.title,
}) %}
{% sproutseo 'optimize' %}
1
2
3
4
5
2
3
4
5
section/_entry.twig (extends your layout)
Below is an example of all of the values you can override.
twig
{% do sprout.meta.update({
title: entry.title,
description: entry.body|striptags|slice(0, 150),
canonical: '',
robots: 'noindex,nofollow',
region: '',
placename: '',
latitude: '',
longitude: '',
ogTitle: '',
ogType: '',
ogUrl: '',
ogImage: '',
ogImageWidth: '',
ogImageHeight: '',
ogImageType: '',
ogSiteName: '',
ogAuthor: '',
ogPublisher: '',
ogDescription: '',
ogAudio: '',
ogVideo: '',
ogLocale: '',
twitterCard: '',
twitterSite: '',
twitterCreator: '',
twitterTitle: '',
twitterDescription: '',
twitterUrl: '',
twitterImage: '',
twitterPlayer: '',
twitterPlayerStream: '',
twitterPlayerStreamContentType: '',
twitterPlayerWidth: '',
twitterPlayerHeight: '',
}) %}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36