all repos — homestead @ e4e8173ab6124daa84ef012e73c111f111d4a8cf

Code for my website

refactor: make templates take a more specific struct

Alan Pearce
commit

e4e8173ab6124daa84ef012e73c111f111d4a8cf

parent

a9f47f4e4ed3223e86dc1d5c3edd005b8d9ce589

1 file changed, 8 insertions(+), 0 deletions(-)

changed files
M internal/website/website.gointernal/website/website.go
@@ -18,6 +18,7 @@ "go.alanpearce.eu/homestead/internal/stats/goatcounter"
"go.alanpearce.eu/homestead/internal/stats/nullcounter" "go.alanpearce.eu/homestead/internal/storage" "go.alanpearce.eu/homestead/internal/storage/sqlite" + "go.alanpearce.eu/homestead/templates" "go.alanpearce.eu/x/log" "github.com/benpate/digit"
@@ -39,6 +40,7 @@ }
type Website struct { config *config.Config + siteSettings *templates.SiteSettings counter stats.Counter log *log.Logger reader storage.Reader
@@ -100,6 +102,12 @@ if err != nil {
log.Panic("could not load configuration", "error", err) } website.config = cfg + website.siteSettings = &templates.SiteSettings{ + Title: cfg.Title, + DefaultLanguage: cfg.DefaultLanguage, + Menu: cfg.Menus["main"], + InjectLiveReload: false, + } if opts.Development { cfg.CSP.ScriptSrc = slices.Insert(cfg.CSP.ScriptSrc, 0, "'unsafe-inline'")