diff options
| author | grm <grm@eyesin.space> | 2026-09-18 19:34:35 +0300 |
|---|---|---|
| committer | grm <grm@eyesin.space> | 2026-09-18 19:34:35 +0300 |
| commit | 96336d8bacd2bdf81acf9a18e2fe57be9d4e9b4f (patch) | |
| tree | e7851ddadf2ed776ab24a1bad4d446b7c48567db /internal/web/templates/blog/preview.html | |
| parent | 63f9fdff6e5bdf6333a4b7813ebeb5b797838b6d (diff) | |
| download | blogspace-96336d8bacd2bdf81acf9a18e2fe57be9d4e9b4f.tar.gz blogspace-96336d8bacd2bdf81acf9a18e2fe57be9d4e9b4f.tar.bz2 blogspace-96336d8bacd2bdf81acf9a18e2fe57be9d4e9b4f.zip | |
Show a live preview of the header on the Design tab's Menu card
The menu options had grown to a dozen switches with nothing to look at
but the blog after a save. A new POST /b/{sub}/design/preview reads the
form as a save would and renders the header alone — the real blog.css
and theme CSS, the modules in their order, the menu as edited — into a
sandboxed frame that refreshes shortly after every change, with a Wide
screen / Phone toggle. Nothing is stored.
The frame keeps the dashboard's origin (allow-same-origin, no scripts)
so the blog's logo and fonts, linked through /b/<sub>/media since the
root host's /media is the root blog's, get the session cookie; that is
safe because no header module is owner HTML. The frame runs no scripts,
so the page's own script folds the menu in it the way the blog does.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A
Diffstat (limited to 'internal/web/templates/blog/preview.html')
| -rw-r--r-- | internal/web/templates/blog/preview.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/web/templates/blog/preview.html b/internal/web/templates/blog/preview.html new file mode 100644 index 0000000..a87e410 --- /dev/null +++ b/internal/web/templates/blog/preview.html @@ -0,0 +1,18 @@ +{{/* The design page's preview of the header: a page of its own for the + sandboxed frame — the real blog.css and theme CSS, and the header as the + form would save it. Only "preview" is ever executed; the empty content + block keeps the layout's reference satisfied. */}} +{{define "content"}}{{end}} +{{define "preview"}}<!DOCTYPE html> +<html lang="{{.Lang}}"> +<head> +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<title>{{t "Preview"}}</title> +<link rel="stylesheet" href="/static/blog.css"> +<style>{{css .Data.css}}</style> +</head> +<body class="{{.Data.theme.NavClass}}{{with .Data.theme.TitleRuleClass}} {{.}}{{end}}"> +{{template "siteheader" .}} +</body> +</html>{{end}} |
