diff options
| author | grm <grm@eyesin.space> | 2026-09-12 12:33:57 +0300 |
|---|---|---|
| committer | grm <grm@eyesin.space> | 2026-09-12 12:33:57 +0300 |
| commit | dd13e4b73a105ee416b6cfd8eb19b217622c0031 (patch) | |
| tree | 93ce503a09b99115efeeee6cd1a85781c1674b02 /internal/web/templates/layouts | |
| parent | 2b450b66fee4906e746f6e04a6d07a72ff2faf64 (diff) | |
| download | blogspace-dd13e4b73a105ee416b6cfd8eb19b217622c0031.tar.gz blogspace-dd13e4b73a105ee416b6cfd8eb19b217622c0031.tar.bz2 blogspace-dd13e4b73a105ee416b6cfd8eb19b217622c0031.zip | |
Add announcements: blog-wide notices on every page and post
A blog can have any number of announcements ("sections" in the schema):
a book club's next meeting, this month's pick, a holiday closure. Each
has a placement (above or below the posts, or under the menu when the
menu is a left sidebar), a look (highlighted, warning, plain), an order,
and an on/off switch so recurring notices can be kept around while hidden.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A
Diffstat (limited to 'internal/web/templates/layouts')
| -rw-r--r-- | internal/web/templates/layouts/blog.html | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/web/templates/layouts/blog.html b/internal/web/templates/layouts/blog.html index 7e3128e..ac6595b 100644 --- a/internal/web/templates/layouts/blog.html +++ b/internal/web/templates/layouts/blog.html @@ -19,9 +19,11 @@ </div> {{if eq .Data.theme.NavPosition "below-header"}}{{template "blognav" .}}{{end}} <div class="wrap body-wrap"> - {{if eq .Data.theme.NavPosition "left-sidebar"}}{{template "blognav" .}}{{end}} + {{if eq .Data.theme.NavPosition "left-sidebar"}}{{template "blognav" .}}{{if .Data.sidebar}}<div class="sidebar-notices">{{template "notices" .Data.sidebar}}</div>{{end}}{{end}} <div class="content"> + {{template "notices" .Data.above}} {{template "content" .}} + {{template "notices" .Data.below}} </div> </div> <div class="site-footer"> @@ -33,6 +35,12 @@ </body> </html>{{end}} +{{define "notices"}}{{range .}}<aside class="notice notice-{{.Style}}"> + {{if .Title}}<h3 class="notice-title">{{.Title}}</h3>{{end}} + <div class="notice-body">{{html .BodyHTML}}</div> +</aside> +{{end}}{{end}} + {{define "blognav"}}<div class="site-nav"><div class="wrap nav-inner"> {{range .Data.nav}}<a href="{{if .IsHome}}/{{else}}/{{.Slug}}{{end}}"{{if and $.Data.page (eq $.Data.page.ID .ID)}} class="active"{{end}}>{{.Title}}</a> {{end}}</div></div>{{end}} |
