I have configured SeoBundle as stated in docs:
sonata_seo:
page:
title: Default title
metas:
name:
description: Defualt description
keywords: key1, key2
cmf_seo:
title: seo.title
description: seo.description
content_listener:
enabled: false
And placed in base.html.twig:
<head>
{# meta #}
<meta name=viewport content="width=device-width, initial-scale=1">
<meta name="format-detection" content="telephone=no"/>
{{ sonata_seo_title() }}
{{ sonata_seo_metadatas() }}
...
</head>
Now when I refresh page I can see that sonata_seo block title and description are set instead of cmf_seo. In docs there is a warning:
The title and description template is only used when the title is not set on the content object or when the content object is not available, otherwise it'll use the default set by the SonataSeoBundle. You should make sure that the defaults also follow the template.
If only docs would clarify what is "content object" would be great... Anyway I tried removing title and description from sonata_seo block:
sonata_seo:
page: ~
cmf_seo:
title: seo.title
description: seo.description
content_listener:
enabled: false
Now my title becomes "Sonata Project" which is default SonataSeoBundle title.
How do I display cmf_seo title? {{ cmf_seo_title() }} is not working.
what is the value of
seo.titleandseo.descriptionis it something you expect to be translated? Can you serve a longer stacktrace for the exception please?In general
CmfSeoBundleexpects some placeholders (%%content_description%%,%%content_title%%, doubled to make it translatable at the end) to enrich the title/description with dynamic data. That dynamic data can live asSeoContenton the document (content object) you are persisting or as so called extractors which fetch the data from the document (content object). In the first case you have to implementSeoAwareInterfacein second case you can find several extractors in the [doucmentation[(https://symfony.com/doc/current/cmf/bundles/seo/extractors.html).If you wanna simply set static titles, you should stay with the
SonataSeoBundle. We do simply enrich a template defined incmf_seo.title|descriptionwith dynamic data from the current content. We do needsonata_seo.titlefor pages with no content documents (i.e. static pages).