page: Trim newlines after frontmatter

This commit is contained in:
Adnan Maolood 2021-04-26 12:01:46 -04:00
parent f28ba9b9fd
commit 2fc38a97f1

View file

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