aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web')
-rw-r--r--internal/web/handlers_posts.go1
-rw-r--r--internal/web/templates/blog/post.html2
-rw-r--r--internal/web/templates/blog/search.html2
-rw-r--r--internal/web/templates/dashboard/post_form.html1
-rw-r--r--internal/web/templates/partials/postlist.html2
5 files changed, 5 insertions, 3 deletions
diff --git a/internal/web/handlers_posts.go b/internal/web/handlers_posts.go
index ac0dd90..8a54c31 100644
--- a/internal/web/handlers_posts.go
+++ b/internal/web/handlers_posts.go
@@ -113,6 +113,7 @@ func (s *Server) handlePostSave(w http.ResponseWriter, r *http.Request) {
p.BodyMD = strings.ReplaceAll(r.FormValue("body"), "\r\n", "\n")
p.Format = pick(r.FormValue("format"), store.FormatMarkdown, store.FormatHTML)
p.Published = r.FormValue("published") == "on"
+ p.HideDate = r.FormValue("hide_date") == "on"
p.PageID, _ = strconv.ParseInt(r.FormValue("page_id"), 10, 64)
p.Image = fileID(pickFile(p.Image, r.FormValue("image")))
tags, tagsOK := parseTags(strings.Split(r.FormValue("tags"), ","))
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"}}
<article class="post single">
<h1 class="post-title">{{.Data.post.Title}}</h1>
- <p class="post-date">{{if .Data.theme.ShowDates}}{{postdate .Data.theme.DateFormat .Data.post.CreatedAt}} &middot; {{end}}<a href="{{if .Data.page.IsHome}}/{{else}}/{{.Data.page.Slug}}{{end}}">{{.Data.page.Title}}</a></p>
+ <p class="post-date">{{if and .Data.theme.ShowDates (not .Data.post.HideDate)}}{{postdate .Data.theme.DateFormat .Data.post.CreatedAt}} &middot; {{end}}<a href="{{if .Data.page.IsHome}}/{{else}}/{{.Data.page.Slug}}{{end}}">{{.Data.page.Title}}</a></p>
{{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")}}<p class="post-image"><img src="/media/{{$img}}" alt=""></p>{{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 @@
<p class="muted small">{{if eq .Data.total 1}}{{t "One post matches."}}{{else}}{{tf "%d posts match." .Data.total}}{{end}}</p>
<ul class="search-results">
{{range .Data.hits}}<li>
- <a href="/{{.PageSlug}}/{{.Slug}}">{{.Title}}</a>{{if $.Data.theme.ShowDates}} <span class="post-date">{{postdate $.Data.theme.DateFormat .CreatedAt}}</span>{{end}}
+ <a href="/{{.PageSlug}}/{{.Slug}}">{{.Title}}</a>{{if and $.Data.theme.ShowDates (not .HideDate)}} <span class="post-date">{{postdate $.Data.theme.DateFormat .CreatedAt}}</span>{{end}}
<p class="snippet">{{.Snippet}}</p>
</li>
{{end}}</ul>
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."))}}
<label class="check"><input type="checkbox" name="published"{{if .Data.post.Published}} checked{{end}}> {{t "Visible on the blog"}}</label>
+ <label class="check"><input type="checkbox" name="hide_date"{{if .Data.post.HideDate}} checked{{end}}> {{t "Hide the date on this post"}}</label>
<p class="actionrow">
<button type="submit">{{t "Save"}}</button>
{{if .Data.post.ID}}<a class="btn secondary" href="{{.BlogURL}}/{{.Data.post.PageSlug}}/{{.Data.post.Slug}}" target="_blank">{{t "View post"}} &#8599;</a>{{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 @@
<article class="post{{if .Image}} has-thumb{{end}}">
{{if .Image}}<a class="post-thumb" href="/{{.PageSlug}}/{{.Slug}}"><img src="/media/{{.Image}}" alt=""></a>{{end}}
<h2 class="post-title"><a href="/{{.PageSlug}}/{{.Slug}}">{{.Title}}</a></h2>
- {{if $.Data.theme.ShowDates}}<p class="post-date">{{postdate $.Data.theme.DateFormat .CreatedAt}}</p>{{end}}
+ {{if and $.Data.theme.ShowDates (not .HideDate)}}<p class="post-date">{{postdate $.Data.theme.DateFormat .CreatedAt}}</p>{{end}}
{{template "posttags" (dict "tags" .Tags "hash" $.Data.theme.TagHash)}}
<div class="post-body">{{html .Excerpt}}</div>
{{if .HasMore}}<p class="read-more"><a href="/{{.PageSlug}}/{{.Slug}}">{{t "Read more"}} &rarr;</a></p>{{end}}