Changeset a3e2f17 in Klonkt for src/middleware


Ignore:
Timestamp:
06/17/2026 12:49:19 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
1dca23b
Parents:
ee25d45
Message:

Fix: update per-site accent + palette on htmx navigation

The accent colour (style#pcms-site-accent) and palette (html[data-palette])
live in the shell <head>, which is not swapped during htmx nav. As a result
an artist inherited the colours of the previous page (e.g. De Kelderband
got the hub's purple instead of its own green). pcmsNav now sends
accent+palette along; the client updates the accent <style> and
data-palette. Applies to all htmx nav (boost + explicit links).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/middleware/render.js

    ree25d45 ra3e2f17  
    113113      // looks "unclickable". Escape any non-ASCII to \uXXXX: the header stays
    114114      // ASCII-safe and remains valid JSON that htmx parses back unchanged.
     115      // Per-site accent + palette zitten in de shell-<head> (style#pcms-site-accent
     116      // + html[data-palette]) en worden NIET mee-geswapt bij htmx-nav. Stuur ze mee
     117      // zodat de client ze bijwerkt — anders erft een artiest de kleuren van de
     118      // vorige pagina (bv. hub-paars i.p.v. eigen groen). Zelfde afleiding als shell.ejs.
     119      const _navAccent = (_site && _site.accent && /^#[0-9a-fA-F]{6}$/.test(_site.accent))
     120        ? _site.accent : '#c2410c';
     121      const _navPalette = (_site && _site.palette) ? _site.palette : 'sage';
    115122      const triggerJson = JSON.stringify({
    116         pcmsNav: { bodyClass: locals.bodyClass },
     123        pcmsNav: { bodyClass: locals.bodyClass, accent: _navAccent, palette: _navPalette },
    117124        pcmsPostSwap: data.post ? {
    118125          title: data.post.title,
Note: See TracChangeset for help on using the changeset viewer.