Files
puttaalu 431ac2e610 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.
2026-11-04 22:08:52 +01:00

79 lines
3.7 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.Photo.Caption}}</title>
<!-- Open Graph + Twitter card: the preview shown when the link is shared to
WhatsApp, Telegram, etc. URLs are absolute because both crawlers ignore
relative image paths. Served from public/og/, kept under ~250 KB. -->
<meta property="og:type" content="article">
<meta property="og:site_name" content="{{.Author}}">
<meta property="og:title" content="{{.Photo.Caption}}">
<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:image" content="{{.BaseURL}}/{{.Photo.OG}}">
<meta property="og:image:type" content="image/jpeg">
{{if .Photo.OGWidth}}<meta property="og:image:width" content="{{.Photo.OGWidth}}">
<meta property="og:image:height" content="{{.Photo.OGHeight}}">{{end}}
<meta property="og:image:alt" content="{{.Photo.Caption}}">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{.Photo.Caption}}">
<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}}">
<link rel="stylesheet" href="{{.FontsURL}}">
<link rel="stylesheet" href="/static/style.css">
<link rel="icon" href="/static/favicon.ico" sizes="any">
<link rel="icon" type="image/png" href="/static/web-32.png" sizes="32x32">
<link rel="apple-touch-icon" href="/static/web-192.png">
<style>:root { --serif: '{{.SerifFamily}}', Georgia, serif; --mj: '{{.MlFamily}}', sans-serif; }</style>
<link rel="alternate" type="application/atom+xml" href="/feed.xml" title="Photo Feed">
{{if .Newer}}<link rel="prefetch" href="/photo/{{.Newer.Slug}}/">
<link rel="prefetch" as="image" href="/{{.Newer.Medium}}">{{end}}
{{if .Older}}<link rel="prefetch" href="/photo/{{.Older.Slug}}/">
<link rel="prefetch" as="image" href="/{{.Older.Medium}}">{{end}}
</head>
<body data-slug="{{.Photo.Slug}}">
<div class="photo-page">
<nav class="photo-nav">
<a href="/" class="back-btn">← Back</a>
<span class="photo-nav-neighbours">
{{if .Newer}}<a href="/photo/{{.Newer.Slug}}/" data-nav="newer">← Newer</a>{{end}}
{{if and .Newer .Older}} / {{end}}
{{if .Older}}<a href="/photo/{{.Older.Slug}}/" data-nav="older">Older →</a>{{end}}
</span>
</nav>
<div class="dlayout">
<div class="dimg-wrap">
<a href="/{{.Photo.File}}" target="_blank" rel="noopener">
<img src="/{{.Photo.Medium}}" alt="{{.Photo.Caption}}">
</a>
</div>
<div class="dsidebar">
<div class="dauthor">
<div class="mini-avatar"><span>{{.Initial}}</span></div>
<span class="dauthor-name">{{.Author}}</span>
</div>
<p class="dcaption">{{.Photo.Caption}}</p>
<p class="ddate">{{.Photo.Date.Format "Jan 02, 2006"}}</p>
{{if .Photo.Tags}}
<div class="dtags">
{{range .Photo.Tags}}<a href="/album/{{.Slug}}/" class="tag">{{.Name}}</a>{{end}}
</div>
{{end}}
<p class="dfull"><a href="/{{.Photo.File}}" download>↓ Full size</a></p>
</div>
</div>
</div>
<footer class="site-footer">
© 2000–{{.Year}} {{.Author}}. All rights reserved.
</footer>
<script src="/static/photo-nav.js" defer></script>
<script src="/static/session.js"></script>
</body>
</html>