From ac125593efe689fabd1e48a7023249c8973698b8 Mon Sep 17 00:00:00 2001 From: grm Date: Fri, 18 Sep 2026 11:22:25 +0300 Subject: Add switches to keep announcements off a page or off post pages Announcements showed on every public page. Now each page has a "Show announcements on this page" checkbox (pages.show_notices, on by default) that covers the page and its posts, and the Design tab's Content section has "Show announcements on post pages" (theme.post_notices, on by default) for bloggers who want notices only on listings, not while reading a post. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A --- AGENTS.md | 10 ++++- .../db/migrations/blog/00012_page_show_notices.sql | 7 ++++ internal/i18n/el.go | 21 ++++++----- internal/store/pages.go | 43 +++++++++++----------- internal/web/handlers_blog.go | 12 ++++++ internal/web/handlers_pages.go | 3 +- internal/web/templates/dashboard/design.html | 1 + internal/web/templates/dashboard/page_form.html | 1 + internal/web/templates/dashboard/sections.html | 2 +- internal/web/theme.go | 4 +- internal/web/web_test.go | 16 ++++++++ 11 files changed, 85 insertions(+), 35 deletions(-) create mode 100644 internal/db/migrations/blog/00012_page_show_notices.sql diff --git a/AGENTS.md b/AGENTS.md index 5ac922d..2953025 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -363,7 +363,13 @@ internal/web/ server.go (host router, middleware, render helpers) constraint, so a new style needs a migration), `enabled` and `sort_order`. `blogView` loads the enabled ones and `placeNotices` groups them by placement, moving ones for a side column that is not laid - out into the main column. + out into the main column. Two switches hide them: `pages.show_notices` + (`Page.ShowNotices`, the page form's "Show announcements on this page", + default on) covers the page and its posts, and `theme.post_notices` + (`PostNotices`, Design → Content, default on) covers every post page — + `renderPage`/`handleBlogPost` put `noNotices` (a typed empty map, so the + layout's `index` lookups still work) in `notices` instead. Tag, search + and 404 pages always show them. Rendered by the `notices` template in `layouts/blog.html` inside a `.notices` wrapper; CSS classes `notice notice-