mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-28 16:45:32 +00:00
BUGFIX: order of locals and globasl in template parsing
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user