diff --git a/templating/context.go b/templating/context.go index 348b167..ca586c7 100644 --- a/templating/context.go +++ b/templating/context.go @@ -93,12 +93,13 @@ func (c *TemplateContext) Globals() map[string]string { } func (c *TemplateContext) Template(fsys fs.FS, funcmap *template.FuncMap) (*template.Template, error) { - t, err := readTemplates(fsys, nil, c.globals, funcmap) + // TODO: locals need to be in order: root, head, body + t, err := readTemplates(fsys, nil, c.locals, funcmap) if err != nil { return nil, err } - t, err = readTemplates(fsys, t, c.locals, funcmap) + t, err = readTemplates(fsys, t, c.globals, funcmap) if err != nil { return nil, err } diff --git a/templating/template_registry.go b/templating/template_registry.go index 1249a22..b3e0c03 100644 --- a/templating/template_registry.go +++ b/templating/template_registry.go @@ -51,7 +51,6 @@ func (r *TemplateRegistry) Load() error { // TODO: what if there is no template in the directory above? // What if a certain path is or should uncallable since it has no index or body? func (r *TemplateRegistry) load() error { - // INFO: Parse setrs r.templates, which is why you need to make sure to call Parse() once templates := make(map[string]TemplateContext) fs.WalkDir(r.routesFS, ".", func(path string, d fs.DirEntry, err error) error { if !d.IsDir() { diff --git a/views/head.gohtml b/views/head.gohtml deleted file mode 100644 index c86ac95..0000000 --- a/views/head.gohtml +++ /dev/null @@ -1 +0,0 @@ -KGPZ - Ausgaben {{ .model.year }} diff --git a/views/layouts/components/_menu.gohtml b/views/layouts/components/_menu.gohtml new file mode 100644 index 0000000..7c176ea --- /dev/null +++ b/views/layouts/components/_menu.gohtml @@ -0,0 +1 @@ +this is the menu diff --git a/views/layouts/default/root.gohtml b/views/layouts/default/root.gohtml index 20b2bbf..d293774 100644 --- a/views/layouts/default/root.gohtml +++ b/views/layouts/default/root.gohtml @@ -13,14 +13,6 @@ {{ end }} - {{ if (and .name .title) }} - {{ .name }} - {{ .title }} - {{ else if .name }} - {{ .name }} - {{ else if .title }} - {{ .title }} - {{ end }} - @@ -35,6 +27,10 @@ + {{ block "_menu" . }} + + {{ end }} + {{ block "body" . }} {{ end }} diff --git a/views/routes/datenschutz/head.gohtml b/views/routes/datenschutz/head.gohtml index 2273665..14a3e83 100644 --- a/views/routes/datenschutz/head.gohtml +++ b/views/routes/datenschutz/head.gohtml @@ -1 +1 @@ -KGPZ - Impressum & Datenschutz +KGPZ – Impressum & Datenschutz diff --git a/views/routes/edition/head.gohtml b/views/routes/edition/head.gohtml index 909488c..d46f5d9 100644 --- a/views/routes/edition/head.gohtml +++ b/views/routes/edition/head.gohtml @@ -1 +1 @@ -KGPZ - Geschichte & Edition +KGPZ – Geschichte & Edition diff --git a/views/routes/head.gohtml b/views/routes/head.gohtml new file mode 100644 index 0000000..e9cb841 --- /dev/null +++ b/views/routes/head.gohtml @@ -0,0 +1 @@ +KGPZ – Ausgaben {{ .model.Year }} diff --git a/views/routes/issue/head.gohtml b/views/routes/issue/head.gohtml index e27fe36..ff59dfd 100644 --- a/views/routes/issue/head.gohtml +++ b/views/routes/issue/head.gohtml @@ -1 +1 @@ -KGPZ - Ausgabe {{ .model.Year }}&verythinsp;/&verythinsp;{{ .model.No }} +KGPZ – Ausgabe {{ .model.No }} / {{ .model.Year }} diff --git a/views/routes/kontakt/head.gohtml b/views/routes/kontakt/head.gohtml index 262b171..86c1961 100644 --- a/views/routes/kontakt/head.gohtml +++ b/views/routes/kontakt/head.gohtml @@ -1 +1 @@ -KGPZ - Kontakt +KGPZ – Kontakt diff --git a/views/routes/zitation/head.gohtml b/views/routes/zitation/head.gohtml index d6062e0..855350b 100644 --- a/views/routes/zitation/head.gohtml +++ b/views/routes/zitation/head.gohtml @@ -1 +1 @@ -KGPZ - Zitation +KGPZ – Zitation