refactor: make templates take a more specific struct
1 file changed, 8 insertions(+), 0 deletions(-)
changed files
M internal/website/website.go → internal/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'")