Repository navigation
docs(readme): document the seo.*() methods and their use from PHP - #65
Merged
Merged
Conversation
The README referred to `_metatags.twig`, but the template the extension ships, and the one to copy when overriding it, is `_metatags.html.twig`.
The README only showed `seo.title()` and `seo.metatags()`. Document the other public methods of the `seo` Twig global, the order in which each value is resolved, and how to reach the same object from PHP (e.g. in a custom Twig function) through `Environment::getGlobals()`, instead of creating the Seo class yourself. Also list the variables a custom meta tags template receives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #42
Summary
#42 asks how to use the extension from a custom Twig function, and whether to
use Appolo\BoltSeo\Seo\Seo;. The README only showedseo.title()andseo.metatags(), so it didn't answer that.This PR is documentation only. There are no code changes.
Changes
docs(readme): document the seo.*() methods and their use from PHPseoTwig global (title(),description(),keywords(),image(),robots(),ogtype(),canonical()), with a short Twig example.override_default→ the record's SEO field → the record's own fields → thedefaultconfig.Seoclass yourself. The same object is theseoTwig global, reachable throughEnvironment::getGlobals()from a Twig function withneeds_environment.docs(readme): use the real meta tags template filename: the README said_metatags.twigin three places, but the shipped template (and the file to copy when overriding it) is_metatags.html.twig.Note for #42
registered with
new TwigFunction('my_description', $this->myDescription(...), ['needs_environment' => true]).Manual verification (Bolt 6.1.9)
On a fresh
bolt/projectinstall, I checked every snippet in the README:seo.*()method listed renders in a theme template.src/Twig/, returns the same value asseo.description()._metatags.html.twigfilename, make the extension render the copy in the theme folder.Tests
No behaviour changes, so no new tests.