1
0
mirror of https://git.sr.ht/~adnano/kiln synced 2024-09-19 01:31:36 +02:00

page: Trim newlines after frontmatter

This commit is contained in:
adnano 2021-04-26 12:01:46 -04:00
parent f4a603658e
commit 0a6d61eb5c

View File

@ -1,6 +1,7 @@
package main
import (
"bytes"
"log"
pathpkg "path"
"strings"
@ -54,6 +55,9 @@ func NewPage(path string, content []byte) *Page {
if err := yaml.Unmarshal(frontmatter, &page); err != nil {
log.Printf("failed to parse frontmatter for %q: %v", path, err)
}
// Trim leading newlines from content
content = bytes.TrimLeft(content, "\r\n")
}
// Remove extension from path