Files
pivoine.art/layouts/partials/head/opengraph.html
Sebastian Krüger 3bccbdf82d 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>
2026-02-15 22:51:30 +01:00

45 lines
1.6 KiB
HTML
Executable File

{{- $title := .Title | default .Site.Title -}}
{{- $desc := .Description | default .Summary | default .Site.Params.description | plainify | truncate 200 -}}
{{/* Resolve image: page resource cover.* > .Params.image > site default */}}
{{- $image := "" -}}
{{- with .Resources.GetMatch "cover.*" -}}
{{- $img := .Resize "1200x webp q90" -}}
{{- $image = $img.Permalink -}}
{{- else -}}
{{- with $.Params.image -}}
{{- $image = . -}}
{{- else -}}
{{- $image = $.Site.Params.images.default | default "/images/og-default.png" -}}
{{- end -}}
{{- end -}}
{{- if and $image (not (strings.HasPrefix $image "http")) -}}
{{- $image = $image | absURL -}}
{{- end -}}
<meta property="og:title" content="{{ $title }}">
<meta property="og:description" content="{{ $desc }}">
<meta property="og:type" content="{{ cond (eq .Section "tracks") "music.song" "website" }}">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:locale" content="en_US">
{{- if $image }}
<meta property="og:image" content="{{ $image }}">
<meta property="og:image:alt" content="{{ $title }}">
{{- end }}
{{/* Audio-specific OpenGraph tags */}}
{{- if eq .Section "tracks" }}
{{- with .Resources.GetMatch "track.*" }}
<meta property="og:audio" content="{{ .Permalink }}">
<meta property="og:audio:type" content="audio/mpeg">
{{- end }}
{{- if $.Params.duration }}
<meta property="music:duration" content="{{ $.Params.duration }}">
{{- end }}
{{- if $.Params.artist }}
<meta property="music:musician" content="{{ $.Params.artist }}">
{{- end }}
{{- end }}