diff options
| author | ivar <i@oiee.no> | 2026-04-07 00:23:24 +0200 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2026-04-07 00:23:24 +0200 |
| commit | 85920b8c7a2696115d1f77c046f48f6f00d639f1 (patch) | |
| tree | 14ed2043796eadd6ed5b0a95c55e38e48713d638 /templates/post.html | |
| download | iblog-85920b8c7a2696115d1f77c046f48f6f00d639f1.tar.xz iblog-85920b8c7a2696115d1f77c046f48f6f00d639f1.zip | |
Init
Diffstat (limited to 'templates/post.html')
| -rw-r--r-- | templates/post.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/templates/post.html b/templates/post.html new file mode 100644 index 0000000..10c51ee --- /dev/null +++ b/templates/post.html @@ -0,0 +1,47 @@ +{{define "post.html"}} +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>{{.Title}}</title> + <link rel="stylesheet" href="/assets/styles/main.css"> + <script type="importmap"> + { + "imports": { + "shared": "/assets/lib/shared.js", + "thumbhash": "/assets/lib/dist/build.js" + } + } + </script> + {{- range .ComponentScripts}} + <script type="module" src="{{.}}"></script> + {{- end}} +</head> + +<body> + <a id="edit-link" href="/admin{{.Path}}" hidden>Edit</a> + <main> + <time>{{.Date}}</time> + {{.Content}} + </main> + <script type="module"> + import { thumbHashToDataURL } from 'thumbhash' + for (const fig of document.querySelectorAll('figure[data-thumbhash]')) { + const bytes = Uint8Array.from(atob(fig.dataset.thumbhash), c => c.charCodeAt(0)) + fig.style.backgroundImage = `url(${thumbHashToDataURL(bytes)})` + fig.style.backgroundSize = 'cover' + const img = fig.querySelector('img') + if (img) img.addEventListener('load', () => { fig.style.backgroundImage = '' }, { once: true }) + } + </script> + <script> + fetch('/admin/ping', {credentials: 'include'}) + .then(r => { if (r.ok) document.getElementById('edit-link').hidden = false; }) + .catch(() => {}); + </script> +</body> + +</html> +{{end}}
\ No newline at end of file |
