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.

2

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

  • sorry about that I was using the old syntax – Jeroen Aug 15 '18 at 14:15
  • 2
    actually this doesn't work for a 404.twig in the templates folder – Jeroen Dec 28 '18 at 13:15
  • Are you sure? I'm setting it that way here: nystudio107.com/404 – andrew.welch Dec 28 '18 at 17:37
  • 1
    Looks like the title is only updating after save some Seomatic settings page. – Jeroen Feb 12 '19 at 10:07

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.