feat: serve audio as local Hugo page resources instead of Jellyfin
Download all 20 track MP3s from Jellyfin and store them as page bundle resources (track.mp3). Update templates to use .Resources.GetMatch instead of .Params.audio, removing external API key dependencies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
{{- $tracks := slice -}}
|
||||
{{- range .Pages -}}
|
||||
{{- $audio := "" -}}
|
||||
{{- with .Resources.GetMatch "track.*" -}}
|
||||
{{- $audio = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $track := dict
|
||||
"title" .Title
|
||||
"url" .Permalink
|
||||
"slug" .File.ContentBaseName
|
||||
"audio" .Params.audio
|
||||
"audio" $audio
|
||||
"duration" .Params.duration
|
||||
"genre" .Params.genre
|
||||
"image" ""
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{{ define "main" }}
|
||||
{{- $audio := "" -}}
|
||||
{{- with .Resources.GetMatch "track.*" -}}
|
||||
{{- $audio = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<article class="py-16">
|
||||
<div class="container-wide">
|
||||
{{/* Content area with offset */}}
|
||||
@@ -31,15 +35,15 @@
|
||||
{{- $img := .Resize "400x webp q90" }}
|
||||
<figure
|
||||
class="overflow-hidden rounded-lg group cursor-pointer relative aspect-square border border-border"
|
||||
{{- if $.Params.audio }}
|
||||
{{- if $audio }}
|
||||
x-data
|
||||
@click="
|
||||
$store.audio.currentTrack = {
|
||||
title: '{{ $.Title }}',
|
||||
url: '{{ $.Params.audio }}',
|
||||
url: '{{ $audio }}',
|
||||
image: '{{ with $.Resources.GetMatch "cover.*" }}{{ (.Resize "200x webp q85").RelPermalink }}{{ end }}'
|
||||
};
|
||||
window.__pivoine?.audioManager?.play('{{ $.Params.audio }}');
|
||||
window.__pivoine?.audioManager?.play('{{ $audio }}');
|
||||
$store.audio.isPlaying = true;
|
||||
"
|
||||
{{- end }}
|
||||
@@ -66,16 +70,16 @@
|
||||
{{- end }}
|
||||
|
||||
{{/* Play Widget - 2 columns */}}
|
||||
{{- if .Params.audio }}
|
||||
{{- if $audio }}
|
||||
<div
|
||||
x-data
|
||||
@click="
|
||||
$store.audio.currentTrack = {
|
||||
title: '{{ .Title }}',
|
||||
url: '{{ .Params.audio }}',
|
||||
url: '{{ $audio }}',
|
||||
image: '{{ with .Resources.GetMatch "cover.*" }}{{ (.Resize "200x webp q85").RelPermalink }}{{ end }}'
|
||||
};
|
||||
window.__pivoine?.audioManager?.play('{{ .Params.audio }}');
|
||||
window.__pivoine?.audioManager?.play('{{ $audio }}');
|
||||
$store.audio.isPlaying = true;
|
||||
"
|
||||
class="md:col-span-2 flex items-center gap-4 cursor-pointer group"
|
||||
|
||||
Reference in New Issue
Block a user