1

404 page doesn't have a title. It shows "| Sitename" in my case.

I'm using Craft 3 with the SEOmatic plugin and would like to set the title in the 404 template.

{% set seomaticMeta = seomaticMeta | merge({ seoTitle: '404 page not found' }) %}

This gives a internal server error, looks like the seomaticMeta object is not available on the 404 page.

1 Answer 1

3

So it looks like you're using the old syntax for SEOmatic 1.x for Craft 2.x; here's how you do the same thing in SEOmatic for Craft 3:

{% do seomatic.meta.seoTitle("Some Title") %}

c.f.: https://github.com/nystudio107/craft-seomatic#twig-templating

6
  • sorry about that I was using the old syntax
    – Jeroen
    Commented Aug 15, 2018 at 14:15
  • 2
    actually this doesn't work for a 404.twig in the templates folder
    – Jeroen
    Commented Dec 28, 2018 at 13:15
  • Are you sure? I'm setting it that way here: nystudio107.com/404 Commented Dec 28, 2018 at 17:37
  • 1
    Looks like the title is only updating after save some Seomatic settings page.
    – Jeroen
    Commented Feb 12, 2019 at 10:07
  • @Jeroen Saving a settings page clears the caches. So it sounds like you're making Twig templating changes in an environment with devMode off, or you're not clearly caches on deploy. Commented Apr 20, 2020 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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