2. Twig Helpers

Here are the Twig helpers you can use in your layout:

2.1. Render the page title

1
{{ sonata_seo_title() }}

This will render the page title as follows:

1
<title>My custom title</title>

2.2. Render the page title text

1
{{ sonata_seo_title_text() }}

This will render the page title as follows:

1
My custom title

2.3. Render page metadata

1
{{ sonata_seo_metadatas() }}

This will render page metadata as follows:

1
<meta name="my-meta-name" content="my-value"/>

2.4. Render HTML attributes

1
{{ sonata_seo_html_attributes() }}

This will render page HTML attributes as follows: my-attribute="my-value"

2.5. Render head attributes

1
{{ sonata_seo_head_attributes() }}

This will render page head attributes as follows: my-attribute="my-value"

2.7. Render alternates languages

1
{{ sonata_seo_lang_alternates() }}

This will render page alternate languages as follows:

1
<link rel="alternate" href="http://www.example.com/en" hreflang="en"/>