Changeset 3b4095f in Klonkt for src/services/OgImageService.js


Ignore:
Timestamp:
07/01/2026 10:28:08 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
5e52448
Parents:
7f265ce
Message:

feat(seo): og:image light/dark override setting

The auto-generated share card followed the site's default theme (1.2.0); Admin →
SEO now has an explicit override: Auto (follow site theme) / Light / Dark.

  • src/config/database.js — sites.og_theme column (NULL = auto).
  • src/services/OgImageService.js — og_theme wins over theme_override when set.
  • src/routes/og.js — select og_theme for the card route.
  • src/routes/admin-seo.js — save og_theme (validated to light/dark, else auto).
  • src/views/pages/admin-seo.ejs — select under the share-image field.
  • src/services/i18n.js — aseo.og_theme* (nl/en/de).
  • CHANGELOG(.nl/.de).md — under Added.

Closes prutfolio-src-krm.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/OgImageService.js

    r7f265ce r3b4095f  
    9090
    9191  const palette = ThemeService.PALETTES[site.palette] ? site.palette : 'klonkt';
    92   // Follow the site's "default theme for new visitors" (theme_override): a light card when the site
    93   // is set to Light, otherwise dark (an OG image is static, so Auto/Dark → dark).
    94   const theme = site.theme_override === 'light' ? 'light' : 'dark';
     92  // Card variant: an explicit SEO override (og_theme) wins; else follow the site's "default
     93  // theme for new visitors" (theme_override) — light when the site is set to Light, otherwise
     94  // dark (an OG image is static, so Auto/Dark → dark).
     95  const theme = (site.og_theme === 'light' || site.og_theme === 'dark')
     96    ? site.og_theme
     97    : (site.theme_override === 'light' ? 'light' : 'dark');
    9598  const accent = site.accent || ((ThemeService.PALETTES[palette] || ThemeService.PALETTES.klonkt)[theme] || ThemeService.PALETTES.klonkt.dark).accent;
    9699  const key = crypto.createHash('sha1')
Note: See TracChangeset for help on using the changeset viewer.