split content and sitemap code from builder
1 file changed, 4 insertions(+), 4 deletions(-)
changed files
M internal/builder/posts.go → internal/content/posts.go
@@ -1,4 +1,4 @@ -package builder +package content import ( "bytes"@@ -51,7 +51,7 @@ &fences.Extender{}, ), ) -func getPost(filename string) (*PostMatter, []byte, error) { +func GetPost(filename string) (*PostMatter, []byte, error) { matter := PostMatter{} content, err := os.Open(filename) if err != nil {@@ -79,7 +79,7 @@ return buf.String(), nil } -func readPosts(root string, inputDir string, outputDir string) ([]Post, Tags, error) { +func ReadPosts(root string, inputDir string, outputDir string) ([]Post, Tags, error) { tags := mapset.NewSet[string]() posts := []Post{} subdir := filepath.Join(root, inputDir)@@ -95,7 +95,7 @@ if !f.IsDir() && path.Ext(pathFromRoot) == ".md" { output := outputReplacer.Replace(pathFromRoot) url := urlReplacer.Replace(pathFromRoot) log.Debug("reading post", "post", pathFromRoot) - matter, content, err := getPost(pathFromRoot) + matter, content, err := GetPost(pathFromRoot) if err != nil { return nil, nil, err }