Problem/Motivation

Drupal 7 had a site logo token. Drupal 8+ has none. Site builders and module developers can't put the site logo into blocks, emails or other token-enabled text without custom code.

The original core issue went through a lot of iterations, but ended up not being accepted unfortunately, so we moved it here.

Proposed resolution

Add these tokens under the existing site type, with no new top-level token type:

[site:logo]	<img> tag for the active theme's logo
[site:logo:active-theme]	same as [site:logo]
[site:logo:default-theme]	<img> tag for the default theme's logo
[site:logo:theme-THEME]	<img> tag for that installed theme's logo
[site:logo:…:url]	absolute URL of the logo
[site:logo:…:url:absolute]	absolute URL of the logo
[site:logo:…:url:relative]	relative URL of the logo

… stands for active-theme, default-theme or theme-THEME.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork token-3631697

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

grevil created an issue. See original summary.

grevil’s picture

Status: Active » Needs review
Related issues: +#2842780: Add a token for the site logo

Done, please review!

Note, that I moved the original core implementation with the help of Claude Code.

csakiistvan’s picture

Assigned: Unassigned » csakiistvan
csakiistvan’s picture

StatusFileSize
new222.09 KB
new167.29 KB
new311.15 KB

✅ Tested and works — applied MR !143, rebuilt caches and set the global Metatag defaults to title: [current-page:title] | [site:logo:active-theme:url:relative] and image_src: [site:logo:active-theme:url]: /user/login now shows "Log in | /core/themes/olivero/logo.svg" in the browser tab and <link rel="image_src" href="https://tester.ddev.site/core/themes/olivero/logo.svg" /> in the source, where before the fix the tokens stayed unreplaced. The logo tokens work in a real token consumer.

Notes
  • The short forms [site:logo:url] and [site:logo:url:relative] stay unreplaced, while [site:logo] works; the issue title mentions :url, so it may be worth either supporting them or clarifying that a theme selector is required.
  • When the theme has no logo (logo.use_default: false with an empty path), [site:logo] renders an empty string.
csakiistvan’s picture

Assigned: csakiistvan » Unassigned