Closed jayhlee closed 4 years ago
Where in your entry template do you have the code? Make sure it's outside of any blocks, due to parse order it won't work if it's inside one.
If it's outside, do you have caching on?
Also, make sure to code defensively, category
could be null
in your example.
Ah, that makes sense. I needed to create the object outside my block.
And yes, will do! {% set category = entry.blogCategories.one() ?? null %}
I'm having trouble overriding meta data directly from my templates. I have a "blog" channel section where I created a
seomate
object in my "_entry.twig" template to override the seomate.php config settings.However, this override doesn't take. When I run a dump of the
seomate
object, the object itself shows that the override worked. But the object doesn't seem to affect the actual output of the rendered meta tags.Do I need to create the object first, then add the
{% hook 'seomateMeta' %}
after it? I currently have the hook nested inside the<head>
element, which is inside my_layout
. So I'm wondering if I need to sort this relationship out in my_entry
template (i.e. creating a head block in my_layout
template and calling in that block in my_entry
template.).