From d11e4c9544f544b3a024c7ac705a674b4096cf50 Mon Sep 17 00:00:00 2001 From: grm Date: Sun, 13 Sep 2026 00:38:24 +0300 Subject: Add the Layout tab: five areas with modules, columns and a menu editor A blog page is now header, left column, main content, right column and footer, each holding an ordered list of modules (blog title, logo, menu, archive by year/month, recent posts, custom HTML, footer text, RSS link, site map). Side columns have percentage widths, can be hidden, and can keep their space when empty; on phones they stack under the posts. The menu becomes its own ordered list mixing pages and outside links. Announcements are placed per column at its top or bottom. Modules and menu items get tables; the migration derives them from each blog's old theme (nav position, footer text, show-in-nav pages) so existing blogs look the same. Custom HTML is deliberately stored and served as-is (owner's decision; see AGENTS.md for why the blast radius is the blogger's own origin). Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A --- internal/web/templates/dashboard/layout.html | 113 +++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 internal/web/templates/dashboard/layout.html (limited to 'internal/web/templates/dashboard/layout.html') diff --git a/internal/web/templates/dashboard/layout.html b/internal/web/templates/dashboard/layout.html new file mode 100644 index 0000000..7691b1e --- /dev/null +++ b/internal/web/templates/dashboard/layout.html @@ -0,0 +1,113 @@ +{{define "title"}}Layout · {{.Blog.Title}}{{end}} +{{define "content"}} +{{$t := .Data.theme}} +{{$u := print "/b/" .Blog.Subdomain "/layout"}} +
+

Layout

+

Decide what goes where on your blog. Every change here is saved straight away; refresh your blog ↗ to see it. Colours and fonts are on the Design tab.

+
+

ColumnsHeaderLeft columnMain contentRight columnFooterMenu

+ +
+

Columns

+
+
Header{{if not $t.HeaderOn}} (hidden){{end}}
+
+
Left {{$t.LeftWidth}}%
+
Main content {{$t.MainWidth}}%
+
Right {{$t.RightWidth}}%
+
+
Footer{{if not $t.FooterOn}} (hidden){{end}}
+
+
+ +
+ + +
+

Between 15% and 40% each; the main content takes the rest. A column only appears when it has at least one module; as soon as one does, the blog spreads over the whole page. On phones the columns stack: main content first, then the left and right columns, then the footer.

+ +

+
+
+ +{{template "area" (dict "area" "header" "root" . "hint" "The top of every page. Stack the title, a logo and the menu in the order you like. A banner image can be chosen on the Design tab.")}} +{{template "area" (dict "area" "left" "root" . "hint" "A narrow column beside your posts. Good for the menu, an archive or recent posts.")}} + +
+

Main content

+

Your posts and pages always show here. You can add your own HTML before and after them — an intro box, a newsletter form, a badge…

+ + {{range $area := .Data.areaOrder}}{{$mods := index $.Data.areas $area}} + + {{if $mods}}{{$m := index $mods 0}} + + + {{else}} + + + {{end}} + {{end}} +
{{index $.Data.areaNames $area}}{{index $.Data.names $m.Kind}}{{with modsummary $m}} — {{.}}{{end}}edit removeNothing extra.
+
+ +{{template "area" (dict "area" "right" "root" . "hint" "A narrow column on the other side of your posts. Same choices as the left one.")}} +{{template "area" (dict "area" "footer" "root" . "hint" "The bottom of every page: a copyright line, the RSS link, a list of your pages.")}} + + +{{end}} + +{{/* One area card: on/off switch, its modules in order, and an "add" form. */}} +{{define "area"}}{{$r := .root}}{{$area := .area}}{{$u := print "/b/" $r.Blog.Subdomain "/layout"}}{{$on := $r.Data.theme.AreaOn $area}}{{$mods := index $r.Data.areas $area}} +
+
+

{{index $r.Data.areaNames $area}}{{if not $on}} hidden{{end}}

+
+
+

{{.hint}}

+ {{if $mods}} + {{range $mods}} + + + + {{end}} +
+
+
+
{{index $r.Data.names .Kind}}{{with modsummary .}} — {{.}}{{end}} + {{if and (eq .Kind "logo") (not $r.Data.theme.Logo)}}no logo chosen pick one on the Design tab{{end}}{{if modsettings .Kind}}edit {{end}}remove
{{else}}

Nothing here yet{{if ne $area "header"}} — this area is not shown until you add a module{{end}}.

{{end}} +
+ + + +
+
{{end}} -- cgit v1.2.3