aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/theme.go
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2026-09-17 16:42:15 +0300
committergrm <grm@eyesin.space>2026-09-17 16:42:15 +0300
commitd0601f06c080a8eb8d781fdd0e3338cd7ed42690 (patch)
tree1931e4312ee2db15dfd0a99583c8ebadf0393e2b /internal/web/theme.go
parent4a6f987bf7f9d73e9dd33d225fd2d73e9bf69a88 (diff)
downloadblogspace-d0601f06c080a8eb8d781fdd0e3338cd7ed42690.tar.gz
blogspace-d0601f06c080a8eb8d781fdd0e3338cd7ed42690.tar.bz2
blogspace-d0601f06c080a8eb8d781fdd0e3338cd7ed42690.zip
Add post summaries, featured images and a page outro
Recreating gizmolab.net as a blog showed three things the design system could not express, all of them ordinary blog features: - Listings can show a summary and a "Read more" link instead of the whole post (theme.list_style). The summary is the source up to <!--more-->; without the marker a Markdown post is cut at a block boundary after 70 words (never inside a code fence) and an HTML post is shown whole, since cutting hand-written markup blind would leave tags open. Computed at render time (Post.Excerpt/HasMore), nothing new is stored. - A post can carry a featured image (posts.image, a library file that is unset when the file is deleted): a thumbnail floated beside the entry on listings, and on the post page above or below the text, or not at all, as theme.post_image says. The picker is the design page's imagepick; its library panel moves out of design.html into partials/imagelib.html so both forms share it — which also removes a stale pickAction call the design form's click handler would have hit. - A page can have a closing text after its posts (pages.outro_md/html), in the intro's format: the per-page counterpart of the blog-wide "after the posts" module, for a home page that ends in a site map or a widget. The editor partial takes formatof to share another editor's Format row, and its upload field is now <name>_file so two editors fit in one form. 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.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/web/theme.go b/internal/web/theme.go
index acfe158..70b218e 100644
--- a/internal/web/theme.go
+++ b/internal/web/theme.go
@@ -45,6 +45,8 @@ type Theme struct {
ShowDates bool `json:"show_dates"`
DateFormat string `json:"date_format"` // long | short | iso (rendered by i18n.FormatDate)
PostsPerPage int `json:"posts_per_page"` // on listings and tag pages; one of postsPerPageChoices
+ ListStyle string `json:"list_style"` // full | summary (see summary.go)
+ PostImage string `json:"post_image"` // where the post page shows the featured image: top | bottom | list (listings only)
FooterBg string `json:"footer_bg"`
FooterColor string `json:"footer_color"`
@@ -87,7 +89,7 @@ func DefaultTheme() Theme {
Font: "sans", HeadingFont: "same", FontSize: "normal",
HeaderImageHeight: "medium", HeaderAlign: "left", HeaderBg: "#2f3a4a", HeaderText: "#ffffff", TitleSize: "normal",
NavAlign: "left", NavStyle: "normal", NavBg: "#ffffff", NavText: "#222222",
- ShowDates: true, DateFormat: "long", PostsPerPage: postsPerPageChoices[0],
+ ShowDates: true, DateFormat: "long", PostsPerPage: postsPerPageChoices[0], ListStyle: "full", PostImage: "top",
FooterBg: "#2f3a4a", FooterColor: "#d0d5dc", FooterAlign: "center",
LogoSize: "medium",
HeaderOn: true, LeftOn: true, RightOn: true, FooterOn: true, LeftWidth: 25, RightWidth: 25,
@@ -171,6 +173,8 @@ func (t *Theme) normalize() {
t.NavHover = optColor(t.NavHover)
t.DateFormat = pick(t.DateFormat, "long", "short", "iso")
t.PostsPerPage = pickInt(t.PostsPerPage, postsPerPageChoices...)
+ t.ListStyle = pick(t.ListStyle, "full", "summary")
+ t.PostImage = pick(t.PostImage, "top", "bottom", "list")
t.FooterBg = color(t.FooterBg, d.FooterBg)
t.FooterColor = color(t.FooterColor, d.FooterColor)
t.FooterAlign = pick(t.FooterAlign, "center", "left")
@@ -233,6 +237,8 @@ func ThemeFromForm(cur Theme, f url.Values) Theme {
t.ShowDates = on("show_dates")
t.DateFormat = get("date_format")
t.PostsPerPage = num("posts_per_page")
+ t.ListStyle = get("list_style")
+ t.PostImage = get("post_image")
t.FooterBg = get("footer_bg")
t.FooterColor = get("footer_color")
t.FooterAlign = get("footer_align")