diff options
| author | grm <grm@eyesin.space> | 2026-09-17 16:44:11 +0300 |
|---|---|---|
| committer | grm <grm@eyesin.space> | 2026-09-17 16:44:11 +0300 |
| commit | f79f97800f7f9ba1ef2b3e2e56040a952a9668a5 (patch) | |
| tree | f054c3b030911336e39c57a1498a272bb30d7bc0 /internal/web/theme.go | |
| parent | d0601f06c080a8eb8d781fdd0e3338cd7ed42690 (diff) | |
| download | blogspace-f79f97800f7f9ba1ef2b3e2e56040a952a9668a5.tar.gz blogspace-f79f97800f7f9ba1ef2b3e2e56040a952a9668a5.tar.bz2 blogspace-f79f97800f7f9ba1ef2b3e2e56040a952a9668a5.zip | |
Let the header and footer follow the main column
With keep_columns and empty side columns the posts sit in a centred
column while the header and footer still run edge to edge, which reads as
two different pages stacked. The new switch insets their content by the
column widths (the backgrounds stay full width, phones are untouched) so
the whole page lines up as one column — the look a single-column site
expects, without bringing back a content max-width.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A
Diffstat (limited to 'internal/web/theme.go')
| -rw-r--r-- | internal/web/theme.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/web/theme.go b/internal/web/theme.go index 70b218e..1fc78ad 100644 --- a/internal/web/theme.go +++ b/internal/web/theme.go @@ -67,6 +67,10 @@ type Theme struct { // KeepColumns lays the side columns out even when empty or hidden, so // the main content keeps the same width on every page. KeepColumns bool `json:"keep_columns"` + // AlignToMain insets the header's and footer's content to the main + // column's edges (the backgrounds stay full width), so a blog with + // KeepColumns and empty columns reads as one centred column. + AlignToMain bool `json:"align_to_main"` } // Areas of the blog page, in page order. above/below sit inside the main column. @@ -250,6 +254,7 @@ func ThemeFromForm(cur Theme, f url.Values) Theme { t.HeaderOn, t.LeftOn, t.RightOn, t.FooterOn = on("header_on"), on("left_on"), on("right_on"), on("footer_on") t.LeftWidth, t.RightWidth = num("left_width"), num("right_width") t.KeepColumns = on("keep_columns") + t.AlignToMain = on("align_to_main") t.normalize() return t } @@ -452,6 +457,10 @@ a:hover {{"{"}}{{if .LinkHover}} color:{{.LinkHover}};{{end}}{{if eq .LinkUnderl {{- with .TitleSizeCSS}} .site-title { font-size:{{.}}; } {{- end}} +{{- if .AlignToMain}} + body.has-left .site-header .wrap, body.has-left .site-footer .wrap { padding-left:calc(1em + {{.LeftWidth}}%); } + body.has-right .site-header .wrap, body.has-right .site-footer .wrap { padding-right:calc(1em + {{.RightWidth}}%); } +{{- end}} } {{- with .PaddingPhone}} @media (max-width: 700px) { .content { padding:{{.}}; } } |
