mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 01:13:08 +00:00
page: Trim newlines after frontmatter
This commit is contained in:
parent
f4a603658e
commit
0a6d61eb5c
4
page.go
4
page.go
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue