Global Metadata in Templates
Global Metadata is managed from the Globals tab and filled out once when you setup Sprout SEO. Globals ensure you have metadata in place for your website identity and prepare Structured Data for your brand. Globals will help you communicate to the search engines information about your brand identity, how to get in touch, and general details so you always have something relevant about your business in search results and social sharing.
Website Identity
twig
{% set globals = sprout.seo.getGlobalMetadata() %}
{% set identity = globals.identity %}
{{ identity.name }}
{{ identity.alternateName }}
{{ identity.description }}
{% set ogImage = craft.app.elements.getElementById(identity.image) %}
{% if ogImage %}
{{ ogImage.getUrl() }}
{% endif %}
{{ identity.keywords }}
{{ identity.email }}
{{ identity.telephone.country }}
{{ identity.telephone.phone }}
{{ identity.latitude }}
{{ identity.longitude }}
{{ identity.foundingDate.date }}
{{ identity.priceRange }}
{# Opening Hours Start on Sunday #}
{% set days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] %}
{% for day in identity.openingHours %}
{{ days[loop.index0] }} {{ day.open.time }}-{{ day.close.time }}
{% endfor %}
{{ identity.address.countryCode }}
{{ identity.address.administrativeAreaCode }}
{{ identity.address.locality }}
{{ identity.address.postalCode }}
{{ identity.address.address1 }}
{{ identity.address.address2 }}
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
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
Contacts
twig
{% set globals = sprout.seo.getGlobalMetadata(currentSite) %}
{% set contacts = globals.contacts %}
{% for contact in contacts %}
{{ contact.contactType }}
{{ contact.telephone }}
{% endfor %}
1
2
3
4
5
6
7
2
3
4
5
6
7
getContacts
You can display a list of the Contacts from your Global Sprout SEO settings on your website using the getContacts
tag:
twig
{% set contacts = sprout.seo.getContacts(currentSite) %}
<ul>
{% for contact in contacts %}
<li><a href="tel:{{ contact.telephone }}">{{ contact.type }}</a></li>
{% endfor %}
</ul>
1
2
3
4
5
6
7
2
3
4
5
6
7
Social Profiles
twig
{% set globals = sprout.seo.getGlobalMetadata(currentSite) %}
{% set social = globals.social %}
{% for profile in social %}
{{ profile.profileName }}
{{ profile.url }}
{% endfor %}
1
2
3
4
5
6
7
2
3
4
5
6
7
getSocialProfilesTag
You can display a list of the Social Profiles in your Global Sprout SEO settings on your website using the getSocialProfiles
tag:
twig
{% set socialProfiles = sprout.seo.getSocialProfiles(currentSite) %}
<ul>
{% for socialProfile in socialProfiles %}
<li><a href="{{ socialProfile.url }}">{{ socialProfile.name }}</a></li>
{% endfor %}
</ul>
1
2
3
4
5
6
7
2
3
4
5
6
7
Verify Ownership
twig
{% set globals = sprout.seo.getGlobalMetadata(currentSite) %}
{% set ownership = globals.ownership %}
{% for item in ownership %}
{{ item.service }}
{{ item.metaTag }}
{{ item.verificationCode }}
{% endfor %}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Customization
twig
{% set globals = sprout.seo.getGlobalMetadata(currentSite) %}
{% set settings = globals.settings %}
{{ settings.seoDivider }}
{{ settings.defaultOgType }}
{{ settings.ogTransform }}
{{ settings.twitterTransform }}
{{ settings.defaultTwitterCard }}
{{ settings.appendTitleValueOnHomepage }}
{{ settings.appendTitleValue }}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Robots
twig
{% set globals = sprout.seo.getGlobalMetadata(currentSite) %}
{% set robots = globals.robots %}
{% for key,enabled in robots %}
{{ key }}
{{ enabled }}
{% endfor %}
1
2
3
4
5
6
7
2
3
4
5
6
7