Closed lucosius closed 7 months ago
Are you putting that code in a Twig template, or are you putting it in a field in the SEOmatic settings somewhere?
Twig template
Accidentally closed this one…
I'm guessing that category.cat_title
doesn't actually resolve to anything. I think you probably want category.title
no?
I'm guessing that
category.cat_title
doesn't actually resolve to anything. I think you probably wantcategory.title
no?
No but even if I use category.title I get nothing..
Oh I see, you're not doing string interpolation correctly with Twig. It should be:
{% do seomatic.meta.seoTitle("#{category.cat_title} some custom text") %}
see: https://twig.symfony.com/doc/3.x/templates.html#string-interpolation
Hello there,
So I have custom pages based by category and entry type. I want to setup titles and descriptions but for some reason I cannot get working.
I'm trying to use this one:
{% set catSlug = craft.app.request.getSegment(1) %} {% set category = craft.categories.slug(catSlug).one() %} {% do seomatic.meta.seoTitle("{category.cat_title} some custom text") %}
Only "somu custom text" appears in my title but not the category field. What I'm doing wrong?