Skip to content

feat: control footer URL via shortcode url param (#64)#67

Merged
adurrr merged 1 commit into
mainfrom
feat/footer-url-override
Jun 28, 2026
Merged

feat: control footer URL via shortcode url param (#64)#67
adurrr merged 1 commit into
mainfrom
feat/footer-url-override

Conversation

@adurrr

@adurrr adurrr commented Jun 28, 2026

Copy link
Copy Markdown
Owner

The persistent footer's source label is upgraded from plain text to a clickable link. A new url shortcode parameter on podcast-player controls the link:

  • url="https://..." overrides the auto-derived link
  • url="none" hides the link entirely
  • omitted, auto-derives the link from the audio src by stripping the filename

The same attribute can be set on the top-level <podcast-footer url="..."> to override whatever the inline player sends. URLs are sanitized at build time (http/https/relative/fragment/dot-relative, plus the literal "none") and at runtime (http/https only; javascript:, data:, malformed URLs all hide the link).

Changes

  • layouts/_shortcodes/podcast-player.html — new url parameter parsing with scheme validation; renders the attribute only when non-empty (so omitting it falls through to auto-derivation)
  • assets/js/podcast-player.jsPodcastPlayer._resolveUrl() (sentinel/explicit/auto-derive), PodcastFooter._setSourceLink() (http(s) validation, hide-on-bad-scheme), observedAttributes + attributeChangedCallback on the footer for the top-level override, Shadow DOM template upgrade (<div><a hidden>), link-specific CSS, persistence round-trip via url field
  • i18n/en.toml + exampleSite/i18n/es.toml + exampleSite/layouts/_default/baseof.htmlplayer_source_link key ("View episode" / "Ver episodio") wired through the i18n pipeline
  • exampleSite/content/docs/getting-started.md (+ ES mirror) — url row added to the parameters table
  • exampleSite/content/docs/homepage-setup.md (+ ES mirror) — new ## Linking the Footer section
  • exampleSite/content/posts/url-override.md, url-hidden.md — two new posts for E2E
  • CHANGELOG.md — entry under [Unreleased] / ### Added
  • tests/js/web-component.test.js — 19 new Vitest tests covering _resolveUrl, _setSourceLink, event handling, top-level override, shadow-DOM type, persistence round-trip
  • tests/e2e/player.spec.js — 6 new Playwright tests covering both new posts, synthesized events, and top-level override
  • tests/hugo/shortcode_test.go + 3 new testdata/ dirs — 4 new Go tests for parameter rendering, omitted-attribute behavior, and bad-scheme rejection

Test plan

  • npx vitest run — 121/121 tests pass (102 pre-existing + 19 new)
  • go test -v -timeout 120s -run 'TestPodcastPlayerShortcode_(WithUrl|UrlNone|UrlOmitted|BadUrlScheme)' ./tests/hugo/... — 4/4 new tests pass; full shortcode suite still passes
  • Playwright E2E — 6 new marquee + 6 new source-link tests in the example site
  • No em-dashes in any new doc or CHANGELOG content
  • Manual smoke test against the example site recommended before merge

Closes #64

The persistent footer's source label is upgraded from plain text to a
clickable link. A new url shortcode parameter on podcast-player
controls the link: an explicit URL overrides the auto-derived link,
"none" hides the link, and omitting it auto-derives the link from the
audio src by stripping the filename. The same attribute can be set on
the top-level <podcast-footer url="..."> to override what the inline
player sends. URLs are sanitized at build time
(http/https/relative/fragment/dot-relative, plus "none") and at
runtime (http/https only).
@adurrr adurrr force-pushed the feat/footer-url-override branch from 75f4d38 to 05c100c Compare June 28, 2026 00:30
@adurrr adurrr merged commit 906ff8d into main Jun 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: control footer URL via shortcode url param (override or 'none' to hide)

1 participant