Feature
This garden is published as one static build to two hosts — GitHub Pages
(utensil.github.io/garden) and tangled (utensil.tngl.sh/garden). Some links
should point at the host you’re actually on rather than a fixed one. The footer
Source link is the first user of this: when served from github.io it
points at the GitHub repo, and from tngl.sh at the tangled repo
(tangled.org/…).
Because the same files are served from both hosts, the choice can’t be made at build time — it’s decided in the browser from the current hostname.
Usage
The footer Source link switches automatically; nothing to do.
To make any other link or embed deployment-aware, give it per-platform attributes and the runtime script fills in the right one:
<!-- a link -->
<a href="…default…" data-href-github="…" data-href-tangled="…">Source</a>
<!-- an iframe (e.g. embedding the host-native blog/forest once they exist on tangled) -->
<iframe data-src-github="…" data-src-tangled="…"></iframe>document.documentElement also gets a data-platform="github|tangled" attribute
you can target from CSS.
Implementation
quartz/components/scripts/deployment.inline.ts— runs on load and on every SPAnav: readswindow.location.hostname, pickstangledfor*.tngl.shor*.tngl.orgelsegithub, setsdata-platformon<html>, then rewrites everya[data-href-github]’shrefand everyiframe[data-src-github]’ssrcto the matchingdata-*-{platform}value.quartz/components/Footer.tsx— renders the Source link with both URLs (data-href-github/data-href-tangled, default = GitHub) and wires the script viaFooter.afterDOMLoaded. (Also adds the “with custom features” link to the Quartz credit line, pointing at this folder viapathToRoot.)quartz.layout.ts— configuresComponent.Footer({ source: { github, tangled } }).
Builds on the absolute base-path URLs from Hosting on tangled (the script only swaps opted-in links; everything else is already host-agnostic).