diff --git a/caddy/setup/markdown.go b/caddy/setup/markdown.go index 65344a74..f3c813db 100644 --- a/caddy/setup/markdown.go +++ b/caddy/setup/markdown.go @@ -61,10 +61,15 @@ func markdownParse(c *Controller) ([]*markdown.Config, error) { } // Get the path scope - if !c.NextArg() || c.Val() == "{" { + args := c.RemainingArgs() + switch len(args) { + case 0: + md.PathScope = "/" + case 1: + md.PathScope = args[0] + default: return mdconfigs, c.ArgErr() } - md.PathScope = c.Val() // Load any other configuration parameters for c.NextBlock() { diff --git a/middleware/markdown/generator.go b/middleware/markdown/generator.go index 9db82bdc..d3485e91 100644 --- a/middleware/markdown/generator.go +++ b/middleware/markdown/generator.go @@ -17,22 +17,24 @@ import ( // It only generates static files if it is enabled (cfg.StaticDir // must be set). func GenerateStatic(md Markdown, cfg *Config) error { - // If static site generation is enabled. + // Generate links since they may be needed, even without sitegen. + generated, err := generateLinks(md, cfg) + if err != nil { + return err + } + + // No new file changes, return. + if !generated { + return nil + } + + // If static site generation is enabled, generate the site. if cfg.StaticDir != "" { - generated, err := generateLinks(md, cfg) - if err != nil { - return err - } - - // No new file changes, return. - if !generated { - return nil - } - if err := generateStaticHTML(md, cfg); err != nil { return err } } + return nil }