all repos — vite @ cf6acc3b2905bd905bd44805a159e4bb3b6072e6

a fast (this time, actually) and minimal static site generator

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
commit

cf6acc3b2905bd905bd44805a159e4bb3b6072e6

parent

45310dfe7ecd7b5407640287e4e7069a53cf7100

3 files changed, 6 insertions(+), 1 deletions(-)

jump to
M commands/build.gocommands/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.gocommands/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.goformats/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,