{{/* Tapedeck — now playing. Drop this file in your site as layouts/shortcodes/tapedeck-now-playing.html, then in any page: {{< tapedeck-now-playing src="https://tapedeck.example.com/public/np/you" >}} Parameters src required. Your public address, from Settings → Sharing. interval optional, seconds between polls. Default 20. title optional heading. Pass title="" for none. compact optional "true" — one line, no cover, no bar. The endpoint is public and CORS-open by design, so this runs entirely in the reader's browser and your site needs no build-time secret and no proxy. It degrades to nothing. A server that is down, a 404, a deck with nothing on it — all of them render an empty element rather than an error, because a personal site should not grow a broken box when a Raspberry Pi reboots. */}} {{- $src := .Get "src" -}} {{- if not $src -}} {{- errorf "tapedeck-now-playing: `src` is required — the public address from Settings → Sharing (%s)" .Position -}} {{- end -}} {{- $interval := int (default 20 (.Get "interval")) -}} {{- $heading := cond (isset .Params "title") (.Get "title") "Now playing" -}} {{- $compact := eq (.Get "compact") "true" -}} {{- $id := printf "tdnp-%d" .Ordinal -}} {{/* Emitted once per page however many times the shortcode is used. */}} {{- if not (.Page.Scratch.Get "tapedeckNowPlayingAssets") -}} {{- .Page.Scratch.Set "tapedeckNowPlayingAssets" true -}} {{- end -}}
{{- with $heading }}

{{ . }}

{{ end }}