Phase 1, part 2: Inbox, scheduled publishing and UTM tags
- Inbox: a top-level page, with a count in the menu, for everything waiting for approval; Content's drafts are reviewed there. /drafts redirects to it. - Scheduling: publish a draft now or at a time (migration 3 adds publish_at). A scheduler in the app publishes due drafts every 30 seconds. Posts more than 12 hours overdue, or refused before posting, go back to the Inbox with the reason. Content gets Scheduled and Published tabs. - UTM tags on links to the company's own websites and product pages, added when publishing; drafts stay untagged. - The container runs in the computer's time zone, so times are shown and read correctly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -95,7 +95,12 @@ func (s *Server) Handler() (http.Handler, error) {
|
||||
mux.HandleFunc("GET /content/{id}", s.contentEntry)
|
||||
mux.HandleFunc("POST /content/{id}/fetch", s.contentFetch)
|
||||
mux.HandleFunc("POST /content/{id}/items", s.contentItems)
|
||||
mux.HandleFunc("GET /drafts", s.draftsPage)
|
||||
mux.HandleFunc("GET /content/scheduled", s.scheduledPage)
|
||||
mux.HandleFunc("GET /content/published", s.publishedPage)
|
||||
mux.HandleFunc("GET /inbox", s.inboxPage)
|
||||
mux.HandleFunc("GET /drafts", func(w http.ResponseWriter, r *http.Request) {
|
||||
redirect(w, r, "/inbox", r.URL.Query().Get("msg"))
|
||||
})
|
||||
mux.HandleFunc("POST /drafts/{id}/{action}", s.draftAction)
|
||||
|
||||
mux.HandleFunc("GET /core", s.corePage)
|
||||
@@ -201,6 +206,7 @@ type page struct {
|
||||
Flash string
|
||||
Error string
|
||||
Data any
|
||||
Inbox int // drafts waiting for review, shown in the menu
|
||||
}
|
||||
|
||||
// render writes a full page, or only its "content" block for htmx requests
|
||||
@@ -212,6 +218,7 @@ func (s *Server) render(w http.ResponseWriter, r *http.Request, name string, p p
|
||||
return
|
||||
}
|
||||
p.Version = s.Version
|
||||
p.Inbox = s.inboxCount()
|
||||
if p.Flash == "" {
|
||||
p.Flash = flashes[r.URL.Query().Get("msg")]
|
||||
}
|
||||
@@ -247,6 +254,8 @@ var flashes = map[string]string{
|
||||
"drafted": "Drafts written. Review them below.",
|
||||
"published": "Published.",
|
||||
"discarded": "Discarded.",
|
||||
"scheduled": "Scheduled.",
|
||||
"unscheduled": "Back in the Inbox: edit it, then publish or schedule it again.",
|
||||
}
|
||||
|
||||
func redirect(w http.ResponseWriter, r *http.Request, path, msg string) {
|
||||
|
||||
Reference in New Issue
Block a user