Skip to content

fix(field): describe what the canonical link field actually overrides - #70

Merged
Fredxd merged 1 commit into
AppoloDev:mainfrom
Vondry:fix/canonical-help-text
Oct 24, 2026
Merged

Fredxd merged 1 commit into
AppoloDev:mainfrom
Vondry:fix/canonical-help-text

Conversation

@Vondry

@Vondry Vondry commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The "Canonical Link" field's help text in the editor said:

Use this to override the <link rel="canonical">.

The extension never outputs a <link rel="canonical">. Bolt renders that tag itself: Bolt\Widget\CanonicalLinkWidget adds it at the end of <head>, with the URL from Bolt's own Canonical service. The field's value is returned by Seo::canonical(), which templates/_metatags.html.twig 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.

Changes

  • Help text (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.
  • Translations: the unit is replaced in all 15 messages.*.xlf files. 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.
  • New test (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, phpstan and bin/lint-xliff translations all pass.
  • On a Bolt 6 install, a record whose SEO field has a canonical URL gets that URL in og:url and twitter:url, while <link rel="canonical"> keeps Bolt's URL.

Related

The README already describes this field correctly: "Overriding the URL used in og:url and twitter:url".

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
Vondry force-pushed the fix/canonical-help-text branch from af3334b to acca00a Compare October 24, 2026 08:31
@Fredxd
Fredxd merged commit 8191c54 into AppoloDev:main Oct 24, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants