Add ability to mark posts as draft These will be skipped during build stage.
Anirudh Oppiliappan x@icyphox.sh
Sun, 17 Nov 2024 12:28:53 +0200
3 files changed,
6 insertions(+),
1 deletions(-)
M
commands/build.go
→
commands/build.go
@@ -111,7 +111,6 @@ }
if err := util.CopyDir(types.StaticDir, buildStatic); err != nil { return err } - fmt.Println("done") return nil }
M
commands/new.go
→
commands/new.go
@@ -19,6 +19,7 @@ slug: %s
title: subtitle: date: %s +draft: true ---`, url, time.Now().Format("2006-01-02")) if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
M
formats/markdown/markdown.go
→
formats/markdown/markdown.go
@@ -107,6 +107,11 @@ if err != nil {
return fmt.Errorf("markdown: error extracting frontmatter: %w", err) } + if md.frontmatter["draft"] == "true" { + fmt.Printf("vite: skipping draft %s\n", md.Path) + return nil + } + err = md.template(dest, types.TemplatesDir, templateData{ config.Config, md.frontmatter,