mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 09:23:09 +00:00
Fix template lookup
This commit is contained in:
parent
f519317ebd
commit
be14245284
2
dir.go
2
dir.go
|
@ -93,7 +93,7 @@ func (d *Dir) manipulate(cfg *Config) error {
|
|||
// Manipulate pages
|
||||
for i := range d.Pages {
|
||||
var b strings.Builder
|
||||
tmpl := cfg.Templates.FindTemplate(d.Pages[i].Path, "page.gmi")
|
||||
tmpl := cfg.Templates.FindTemplate(d.Path, "page.gmi")
|
||||
if err := tmpl.Execute(&b, d.Pages[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
4
main.go
4
main.go
|
@ -78,7 +78,9 @@ func outputHTML(p *Page, cfg *Config) (path string, content []byte) {
|
|||
}
|
||||
|
||||
var b bytes.Buffer
|
||||
tmpl := cfg.Templates.FindTemplate(pathpkg.Dir(path), "output.html")
|
||||
// clean path to remove trailing slash
|
||||
dir := pathpkg.Dir(pathpkg.Clean(p.Path))
|
||||
tmpl := cfg.Templates.FindTemplate(dir, "output.html")
|
||||
tmpl.Execute(&b, &htmlCtx{
|
||||
Title: p.Title,
|
||||
Content: string(content),
|
||||
|
|
Loading…
Reference in a new issue