0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

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)
This commit is contained in:
Matthew Holt 2015-08-01 16:09:10 -06:00
parent b401267aa4
commit 36fa6e857b

View file

@ -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{}