Commit 36fa6e85 authored by Matthew Holt's avatar Matthew Holt

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)
parent b401267a
...@@ -68,7 +68,16 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) { ...@@ -68,7 +68,16 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) {
l.generating = true l.generating = true
l.Unlock() 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{} cfg.Links = []PageLink{}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment