From 2a347ced1b4ea8c24440f646df35207c3a3597ac Mon Sep 17 00:00:00 2001 From: grm Date: Thu, 17 Sep 2026 21:42:02 +0300 Subject: Let a post hide its date A checkbox on the post form (posts.hide_date) overriding the theme's "show the date on posts" for that post alone: listings, the post page and search results leave the date out; the feed keeps its pubDate. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A --- internal/web/templates/blog/post.html | 2 +- internal/web/templates/blog/search.html | 2 +- internal/web/templates/dashboard/post_form.html | 1 + internal/web/templates/partials/postlist.html | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) (limited to 'internal/web/templates') diff --git a/internal/web/templates/blog/post.html b/internal/web/templates/blog/post.html index d16e842..33a1723 100644 --- a/internal/web/templates/blog/post.html +++ b/internal/web/templates/blog/post.html @@ -2,7 +2,7 @@ {{define "content"}}

{{.Data.post.Title}}

- + {{template "posttags" (dict "tags" .Data.post.Tags "hash" .Data.theme.TagHash)}} {{$img := .Data.post.Image}}{{$place := .Data.theme.PostImage}} {{if and $img (eq $place "top")}}

{{end}} diff --git a/internal/web/templates/blog/search.html b/internal/web/templates/blog/search.html index 7ee05fc..9a00c9d 100644 --- a/internal/web/templates/blog/search.html +++ b/internal/web/templates/blog/search.html @@ -8,7 +8,7 @@

{{if eq .Data.total 1}}{{t "One post matches."}}{{else}}{{tf "%d posts match." .Data.total}}{{end}}

    {{range .Data.hits}}
  • - {{.Title}}{{if $.Data.theme.ShowDates}} {{end}} + {{.Title}}{{if and $.Data.theme.ShowDates (not .HideDate)}} {{end}}

    {{.Snippet}}

  • {{end}}
diff --git a/internal/web/templates/dashboard/post_form.html b/internal/web/templates/dashboard/post_form.html index 9bd7624..e64a331 100644 --- a/internal/web/templates/dashboard/post_form.html +++ b/internal/web/templates/dashboard/post_form.html @@ -41,6 +41,7 @@ {{template "editor" (dict "name" "body" "value" .Data.post.BodyMD "format" .Data.post.Format "rows" 24 "tall" true "upload" (print "/b/" .Blog.Subdomain "/files/upload") "preview" (print "/b/" .Blog.Subdomain "/preview") "csrf" .CSRF)}} {{template "imagepick" (dict "name" "image" "current" .Data.post.Image "sub" .Blog.Subdomain "images" .Data.images "names" .Data.imageNames "label" (t "Featured image") "hint" (t "Optional. A thumbnail on listings, and on the post page where the Design tab puts it."))}} +

{{if .Data.post.ID}}{{t "View post"}} ↗{{end}} diff --git a/internal/web/templates/partials/postlist.html b/internal/web/templates/partials/postlist.html index 91e248c..fce6291 100644 --- a/internal/web/templates/partials/postlist.html +++ b/internal/web/templates/partials/postlist.html @@ -6,7 +6,7 @@

{{if .Image}}{{end}}

{{.Title}}

- {{if $.Data.theme.ShowDates}}{{end}} + {{if and $.Data.theme.ShowDates (not .HideDate)}}{{end}} {{template "posttags" (dict "tags" .Tags "hash" $.Data.theme.TagHash)}}
{{html .Excerpt}}
{{if .HasMore}}

{{t "Read more"}} →

{{end}} -- cgit v1.2.3