Documentation
¶
Overview ¶
Package publicpages serves the pages subscribers see (spec 5.12, 7.12), server-rendered with html/template under the layout of internal/publicurl:
/p/{workspace}/subscribe[/{form}] hosted subscribe page (GET, POST)
/p/{workspace}/confirm/{token} double opt-in confirmation
/p/{workspace}/preferences[/{token}] preference center (or ask for a link)
/p/{workspace}/unsubscribe/{token} unsubscribe page; POST is RFC 8058 one-click
/p/{workspace}/view/{token} an email in the browser
/p/{workspace}/archive[/{issue}] public archive, archive.rss, sitemap.xml
/p/{workspace}/forms/{id}.js embed script, /session and /submit
/p/_/… stylesheet, fonts, scripts
A workspace's verified custom domain serves the same pages at its root (news.acme.io/subscribe). The pages work without JavaScript and cookies, load no third-party code (Cloudflare Turnstile only on a challenge page), run under a strict CSP without inline scripts or styles, and carry full metadata; every page reached through a signed link is noindex.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler struct {
Pool *pgxpool.Pool
Q *store.Queries
Forms *forms.Service
Audience *audience.Service
Tokens *linktoken.Signer
URLs publicurl.Builder
Log *slog.Logger
// SPA answers root paths on hosts that aren't a custom domain.
SPA http.Handler
// LandingURL is where "Sent with ReputeCast" points.
LandingURL string
Now func() time.Time
// contains filtered or unexported fields
}
type PublicPagePreview ¶
type PublicPagePreview struct {
// HTML is the page as subscribers see it; links and buttons are inert.
HTML string `json:"html"`
// URL is where the page lives (the custom domain once verified); empty
// for pages only signed links open (confirmation, unsubscribe).
URL string `json:"url"`
// Contact is whose page it is: the subscriber who confirmed last, or an example address.
Contact string `json:"contact"`
}
PublicPagePreview is a public page rendered for the app.
Click to show internal directories.
Click to hide internal directories.