Skip to content

Commit

Permalink
fix ugly error when layout is not template (#55)
Browse files Browse the repository at this point in the history
Resolves: #47

Co-authored-by: quantum-ernest <[email protected]>
  • Loading branch information
quantum-ernest and quantum-ernest authored Dec 27, 2024
1 parent 8df494d commit 87b008d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions site/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ func (site *site) loadLayouts() error {
if err != nil {
return checkFileError(err)
}
if templ == nil {
return fmt.Errorf("invalid layout file: '%s' is missing front matter '---'."+
" Ensure the file starts with '---'", filename)
}

layout_name := strings.TrimSuffix(filename, filepath.Ext(filename))
site.layouts[layout_name] = *templ
Expand Down

0 comments on commit 87b008d

Please sign in to comment.