Skip to content

How to handle the removal of globals? #92

Answered by mmikkel
mattbloomfield asked this question in Q&A
Discussion options

You must be logged in to vote

The 'defaultMeta' setting works with any object in your global Twig context, so your "SeoDefaults" doesn't necessarily have to be a global set (globals are just convenient to use because they're... global 🙃).

In other words, to use a single entry for the default meta, you have to make sure it's in your global Twig context (the below example assumes you have something like 'defaultSeo.seoTitle' etc in your default meta config):

{% set defaultSeo = craft.entries.section('defaultSeo').one() %}

{% hook 'seomateMeta' %}

...pretty awkward stuff. Things will probably change in SEOMate once global sets are actually removed from core (probably Craft 5.0), but I'm reluctant to refactor anything un…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mmikkel
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
3 participants
Converted from issue

This discussion was converted from issue #78 on September 07, 2024 21:31.