feat: control footer URL via shortcode url param (#64)#67
Merged
Conversation
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).
75f4d38 to
05c100c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The persistent footer's source label is upgraded from plain text to a clickable link. A new
urlshortcode parameter onpodcast-playercontrols the link:url="https://..."overrides the auto-derived linkurl="none"hides the link entirelyThe 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— newurlparameter parsing with scheme validation; renders the attribute only when non-empty (so omitting it falls through to auto-derivation)assets/js/podcast-player.js—PodcastPlayer._resolveUrl()(sentinel/explicit/auto-derive),PodcastFooter._setSourceLink()(http(s) validation, hide-on-bad-scheme),observedAttributes+attributeChangedCallbackon the footer for the top-level override, Shadow DOM template upgrade (<div>→<a hidden>), link-specific CSS, persistence round-trip viaurlfieldi18n/en.toml+exampleSite/i18n/es.toml+exampleSite/layouts/_default/baseof.html—player_source_linkkey ("View episode" / "Ver episodio") wired through the i18n pipelineexampleSite/content/docs/getting-started.md(+ ES mirror) —urlrow added to the parameters tableexampleSite/content/docs/homepage-setup.md(+ ES mirror) — new## Linking the FootersectionexampleSite/content/posts/url-override.md,url-hidden.md— two new posts for E2ECHANGELOG.md— entry under[Unreleased]/### Addedtests/js/web-component.test.js— 19 new Vitest tests covering_resolveUrl,_setSourceLink, event handling, top-level override, shadow-DOM type, persistence round-triptests/e2e/player.spec.js— 6 new Playwright tests covering both new posts, synthesized events, and top-level overridetests/hugo/shortcode_test.go+ 3 newtestdata/dirs — 4 new Go tests for parameter rendering, omitted-attribute behavior, and bad-scheme rejectionTest 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 passesCloses #64