mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 09:23:09 +00:00
page: Don't fallback to base template
Don't fallback to the base template when looking for page and index templates.
This commit is contained in:
parent
4b39c0bfe1
commit
3a3ec83e0f
8
page.go
8
page.go
|
@ -194,10 +194,6 @@ func (p *Page) process(cfg *Site, task *Task) error {
|
||||||
// Create index
|
// Create index
|
||||||
if p.index {
|
if p.index {
|
||||||
tmpl, ok := cfg.templates.FindTemplate(p.FilePath, "index"+task.TemplateExt)
|
tmpl, ok := cfg.templates.FindTemplate(p.FilePath, "index"+task.TemplateExt)
|
||||||
if !ok {
|
|
||||||
// Try the base template
|
|
||||||
tmpl, ok = cfg.templates.FindTemplate(p.FilePath, "base"+task.TemplateExt)
|
|
||||||
}
|
|
||||||
if ok {
|
if ok {
|
||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
if err := tmpl.Execute(&b, p); err != nil {
|
if err := tmpl.Execute(&b, p); err != nil {
|
||||||
|
@ -211,10 +207,6 @@ func (p *Page) process(cfg *Site, task *Task) error {
|
||||||
for i := range p.Pages {
|
for i := range p.Pages {
|
||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
tmpl, ok := cfg.templates.FindTemplate(p.FilePath, "page"+task.TemplateExt)
|
tmpl, ok := cfg.templates.FindTemplate(p.FilePath, "page"+task.TemplateExt)
|
||||||
if !ok {
|
|
||||||
// Try the base template
|
|
||||||
tmpl, ok = cfg.templates.FindTemplate(p.FilePath, "base"+task.TemplateExt)
|
|
||||||
}
|
|
||||||
if ok {
|
if ok {
|
||||||
if err := tmpl.Execute(&b, p.Pages[i]); err != nil {
|
if err := tmpl.Execute(&b, p.Pages[i]); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue