From 36fa6e857bd22a59017ad703414c42e19a5cc1c7 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Sat, 1 Aug 2015 16:09:10 -0600 Subject: [PATCH] markdown: Sitegen only occurs if directory exists We do this by returning an error and stopping link generation (which scans the markdown path for files) --- middleware/markdown/page.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/middleware/markdown/page.go b/middleware/markdown/page.go index 79810075..d70d8942 100644 --- a/middleware/markdown/page.go +++ b/middleware/markdown/page.go @@ -68,7 +68,16 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) { l.generating = true l.Unlock() - fp := filepath.Join(md.Root, cfg.PathScope) + fp := filepath.Join(md.Root, cfg.PathScope) // path to scan for .md files + + // If the file path to scan for Markdown files (fp) does + // not exist, there are no markdown files to scan for. + if _, err := os.Stat(fp); os.IsNotExist(err) { + l.Lock() + l.lastErr = err + l.Unlock() + return + } cfg.Links = []PageLink{}