MCPcopy
hub / github.com/writefreely/writefreely / initTemplate

Function initTemplate

templates.go:62–84  ·  view source on GitHub ↗
(parentDir, name string)

Source from the content-addressed store, hash-verified

60}
61
62func initTemplate(parentDir, name string) {
63 if debugging {
64 log.Info(" " + filepath.Join(parentDir, templatesDir, name+".tmpl"))
65 }
66
67 files := []string{
68 filepath.Join(parentDir, templatesDir, name+".tmpl"),
69 filepath.Join(parentDir, templatesDir, "include", "footer.tmpl"),
70 filepath.Join(parentDir, templatesDir, "base.tmpl"),
71 filepath.Join(parentDir, templatesDir, "user", "include", "silenced.tmpl"),
72 }
73 if name == "collection" || name == "collection-tags" || name == "collection-archive" || name == "chorus-collection" || name == "read" {
74 // These pages list out collection posts, so we also parse templatesDir + "include/posts.tmpl"
75 files = append(files, filepath.Join(parentDir, templatesDir, "include", "posts.tmpl"))
76 }
77 if name == "chorus-collection" || name == "chorus-collection-post" {
78 files = append(files, filepath.Join(parentDir, templatesDir, "user", "include", "header.tmpl"))
79 }
80 if name == "collection" || name == "collection-tags" || name == "collection-archive" || name == "collection-post" || name == "post" || name == "chorus-collection" || name == "chorus-collection-post" {
81 files = append(files, filepath.Join(parentDir, templatesDir, "include", "post-render.tmpl"))
82 }
83 templates[name] = template.Must(template.New("").Funcs(funcMap).ParseFiles(files...))
84}
85
86func initPage(parentDir, path, key string) {
87 if debugging {

Callers 1

InitTemplatesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected