repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
0515a61
parent
893485f
author
Eric Bower
date
2022-08-10 15:13:47 +0000 UTC
feat: tag posts with slug as classname on body

This will make it easier to do per post style changes.
2 files changed,  +3, -1
M prose/api.go
+2, -0
 1@@ -62,6 +62,7 @@ type PostPageData struct {
 2 	PageTitle    string
 3 	URL          template.URL
 4 	BlogURL      template.URL
 5+	Slug         string
 6 	Title        string
 7 	Description  string
 8 	Username     string
 9@@ -354,6 +355,7 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
10 			BlogURL:      template.URL(cfg.FullBlogURL(username, onSubdomain, withUserName)),
11 			Description:  post.Description,
12 			Title:        shared.FilenameToTitle(post.Filename, post.Title),
13+			Slug:         post.Slug,
14 			PublishAt:    post.PublishAt.Format("02 Jan, 2006"),
15 			PublishAtISO: post.PublishAt.Format(time.RFC3339),
16 			Username:     username,
M prose/html/post.page.tmpl
+1, -1
1@@ -26,7 +26,7 @@
2 {{if .HasCSS}}<link rel="stylesheet" href="{{.CssURL}}" />{{end}}
3 {{end}}
4 
5-{{define "attrs"}}id="post"{{end}}
6+{{define "attrs"}}id="post" class="{{.Slug}}"{{end}}
7 
8 {{define "body"}}
9 <header>