mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-24 01:26:47 +01: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:
parent
b401267aa4
commit
36fa6e857b
1 changed files with 10 additions and 1 deletions
|
@ -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{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue