1

When I use the {% hook 'seomaticRender' %} tag in my template, I expected that it would output the data in the position where it's located. For example, I have the following in my template:

{% hook 'seomaticRender' %}
<meta name="msapplication-TileColor" content="#ffffff">

But when the template is rendered, the Seomatic data is output after the "msapplication-TileColor" meta tag. I don't suppose it matters much, but I like to keep a specific order for tags in my header.

I'm quite sure the answer is somewhere in the documentation, but it would be great to have a comprehensive example template.

2

I this for the Craft 2 version of SEOmatic, or the Craft 3 version of SEOmatic? The Craft 3 version does not have a {% hook 'seomaticRender' %} tag at all.

Instead, the metadata is automatically added where it should go to various parts of the document. I wouldn't recommend changing where this is output without a good reason, but if you really want to:

https://nystudio107.com/docs/seomatic/Using.html

Disable automatic rendering:

{% do seomatic.config.renderEnabled(false) %}

Then where you want each container's output, you'd need to manually do:

{{ seomatic.jsonLd.render() }}
{{ seomatic.link.render() }}
{{ seomatic.script.render() }}
{{ seomatic.tag.render() }}
{{ seomatic.title.render() }}

In the appropriate places in the DOM. The reason it's not recommended that you do this is that SEOmatic puts things where they should go already, and there's no real benefit in moving them around.

1
  • This is for C3, so I will remove the hook tag. I did notice that the SEO renders with or without the tag. Does it make any big-picture difference if the meta title (and everything else handled by Seomatic) is output after my CSS, favicon links, and manifest? I usually place all of that SEO data before. – Vaughn D. Taylor May 28 '20 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.