Show tags in photo link-preview description

og:description and twitter:description now append the photo's tags after the
author and date (" · berlin, sunrise") when present, so a shared link unfurls
with its tags. Falls back to the plain author/date line when a photo is
untagged. Template-only change; tags are HTML-escaped by html/template.
This commit is contained in:
puttaalu committed 2026-11-04 22:08:52 +01:00
1 parent 504b96ed31
commit 431ac2e610
1 file changed
+2 -2
+2 -2
View File
@@ -11,7 +11,7 @@
<meta property="og:type" content="article"> <meta property="og:type" content="article">
<meta property="og:site_name" content="{{.Author}}"> <meta property="og:site_name" content="{{.Author}}">
<meta property="og:title" content="{{.Photo.Caption}}"> <meta property="og:title" content="{{.Photo.Caption}}">
<meta property="og:description" content="{{.Author}} — {{.Photo.Date.Format "January 2, 2006"}}"> <meta property="og:description" content="{{.Author}} — {{.Photo.Date.Format "January 2, 2006"}}{{if .Photo.Tags}} · {{range $i, $t := .Photo.Tags}}{{if $i}}, {{end}}{{$t.Name}}{{end}}{{end}}">
<meta property="og:url" content="{{.BaseURL}}/photo/{{.Photo.Slug}}/"> <meta property="og:url" content="{{.BaseURL}}/photo/{{.Photo.Slug}}/">
<meta property="og:image" content="{{.BaseURL}}/{{.Photo.OG}}"> <meta property="og:image" content="{{.BaseURL}}/{{.Photo.OG}}">
<meta property="og:image:type" content="image/jpeg"> <meta property="og:image:type" content="image/jpeg">
@@ -20,7 +20,7 @@
<meta property="og:image:alt" content="{{.Photo.Caption}}"> <meta property="og:image:alt" content="{{.Photo.Caption}}">
<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{.Photo.Caption}}"> <meta name="twitter:title" content="{{.Photo.Caption}}">
<meta name="twitter:description" content="{{.Author}} — {{.Photo.Date.Format "January 2, 2006"}}"> <meta name="twitter:description" content="{{.Author}} — {{.Photo.Date.Format "January 2, 2006"}}{{if .Photo.Tags}} · {{range $i, $t := .Photo.Tags}}{{if $i}}, {{end}}{{$t.Name}}{{end}}{{end}}">
<meta name="twitter:image" content="{{.BaseURL}}/{{.Photo.OG}}"> <meta name="twitter:image" content="{{.BaseURL}}/{{.Photo.OG}}">
<link rel="stylesheet" href="{{.FontsURL}}"> <link rel="stylesheet" href="{{.FontsURL}}">