diff --git a/page.go b/page.go index b62fddc..5679bbd 100644 --- a/page.go +++ b/page.go @@ -199,6 +199,9 @@ func (p *Page) process(cfg *Site, task *Task) error { tmplName = "index" } tmpl, ok := cfg.templates.FindTemplate(p.FilePath, tmplName+task.TemplateExt) + if !ok && p.Template != "" { + return fmt.Errorf("failed to generate index page %q: template %q specified in frontmatter but not found", p.Path, tmplName) + } if ok { var b strings.Builder if err := tmpl.Execute(&b, p); err != nil { @@ -216,6 +219,9 @@ func (p *Page) process(cfg *Site, task *Task) error { } var b strings.Builder tmpl, ok := cfg.templates.FindTemplate(p.FilePath, tmplName+task.TemplateExt) + if !ok && p.Pages[i].Template != "" { + return fmt.Errorf("failed to generate page %q: template %q specified in frontmatter but not found", p.Pages[i].Path, tmplName) + } if ok { if err := tmpl.Execute(&b, p.Pages[i]); err != nil { return err