Repository navigation
fix(field): describe what the canonical link field actually overrides - #70
Merged
Merged
Conversation
The help text said the field overrides `<link rel="canonical">`, but the extension never outputs that tag. Bolt's CanonicalLinkWidget renders it from Bolt's own canonical URL. The field's value is returned by `Seo::canonical()`, which the meta tags template uses only for `<meta property="og:url">` and `<meta property="twitter:url">`. Editors who set it to change the canonical link saw no effect on that tag. The help text now names those two tags, written the same way as the other help texts, in all 15 translations. A new test checks that every string the field template passes to `__()` has a unit in every translation file, so a reworded text can't silently lose its translations.
Vondry
force-pushed
the
fix/canonical-help-text
branch
from
October 24, 2026 08:31
af3334b to
acca00a
Compare
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.
Summary
The "Canonical Link" field's help text in the editor said:
The extension never outputs a
<link rel="canonical">. Bolt renders that tag itself:Bolt\Widget\CanonicalLinkWidgetadds it at the end of<head>, with the URL from Bolt's ownCanonicalservice. The field's value is returned bySeo::canonical(), whichtemplates/_metatags.html.twiguses only for<meta property="og:url">and<meta property="twitter:url">. Editors who set it to change the canonical link saw no effect on that tag.Changes
templates/seo.html.twig): it now reads "Use this to override the URL in<meta property="og:url">and<meta property="twitter:url">." The tags are written the same way as in the other help texts (<meta name="robots">,<meta property="og:type">). The "Use with caution…" sentence after it is unchanged. The field's label and stored key (canonical) also stay the same, so existing data and custom templates are unaffected.messages.*.xlffiles. The new unit id is derived the same way as the existing ones (the Symfony XLIFF dumper's SHA-256 id). The non-English texts follow the wording of the previous translations, so native speakers may want to check them.tests/Twig/SeoFieldTranslationsTest.php): it renders the whole field template, with the optional keywords field enabled, records every string passed to__(), and checks that each translation file has a unit for it. On the old translation files it fails for every locale and names the missing string. So a reworded help text can no longer lose its translations without CI noticing.Verified
vendor/bin/phpunit: 134 tests pass (15 new).rector,ecs,phpstanandbin/lint-xliff translationsall pass.og:urlandtwitter:url, while<link rel="canonical">keeps Bolt's URL.Related
The README already describes this field correctly: "Overriding the URL used in
og:urlandtwitter:url".