feat: enhance OG/Twitter meta tags with cover images
- Use page resource cover.* for track pages (resized to 1200x webp) - Fall back to .Params.image then configurable site default - Add [images] config section with default OG image path - Add og-default.png (1200x630) with centered logo Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,3 +14,6 @@ email = "valknar@pivoine.art"
|
|||||||
[visualizer]
|
[visualizer]
|
||||||
particleCount = 5000
|
particleCount = 5000
|
||||||
fftSize = 512
|
fftSize = 512
|
||||||
|
|
||||||
|
[images]
|
||||||
|
default = "/images/og-default.png"
|
||||||
|
|||||||
@@ -1,7 +1,19 @@
|
|||||||
{{- $title := .Title | default .Site.Title -}}
|
{{- $title := .Title | default .Site.Title -}}
|
||||||
{{- $desc := .Description | default .Summary | default .Site.Params.description | plainify | truncate 200 -}}
|
{{- $desc := .Description | default .Summary | default .Site.Params.description | plainify | truncate 200 -}}
|
||||||
{{- $image := .Params.image | default "/images/og-default.png" -}}
|
|
||||||
{{- if not (strings.HasPrefix $image "http") -}}
|
{{/* 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 -}}
|
{{- $image = $image | absURL -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,23 @@
|
|||||||
{{- $title := .Title | default .Site.Title -}}
|
{{- $title := .Title | default .Site.Title -}}
|
||||||
{{- $desc := .Description | default .Summary | default .Site.Params.description | plainify | truncate 200 -}}
|
{{- $desc := .Description | default .Summary | default .Site.Params.description | plainify | truncate 200 -}}
|
||||||
{{- $image := .Params.image | default "/images/og-default.png" -}}
|
|
||||||
{{- if not (strings.HasPrefix $image "http") -}}
|
{{/* 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 -}}
|
{{- $image = $image | absURL -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{/* Determine card type */}}
|
{{/* Determine card type - use large image when we have one */}}
|
||||||
{{- $cardType := "summary" -}}
|
{{- $cardType := "summary" -}}
|
||||||
{{- if $image -}}
|
{{- if $image -}}
|
||||||
{{- $cardType = "summary_large_image" -}}
|
{{- $cardType = "summary_large_image" -}}
|
||||||
|
|||||||
BIN
static/images/og-default.png
Normal file
BIN
static/images/og-default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Reference in New Issue
Block a user