From 9e163a655d379eb6d19120a5de3dfd034a0f7eec Mon Sep 17 00:00:00 2001 From: Abiola Ibrahim Date: Tue, 22 Dec 2015 14:43:48 +0100 Subject: [PATCH] Use proper struct constructors instead. --- middleware/markdown/generator.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/middleware/markdown/generator.go b/middleware/markdown/generator.go index 653f457f..d218f22b 100644 --- a/middleware/markdown/generator.go +++ b/middleware/markdown/generator.go @@ -105,8 +105,12 @@ func generateStaticHTML(md Markdown, cfg *Config) error { reqPath = filepath.ToSlash(reqPath) reqPath = "/" + reqPath + // Create empty requests and url to cater for template values. + req, _ := http.NewRequest("", "/", nil) + urlVar, _ := url.Parse("/") + // Generate the static file - ctx := middleware.Context{Root: md.FileSys, Req: new(http.Request), URL: new(url.URL)} + ctx := middleware.Context{Root: md.FileSys, Req: req, URL: urlVar} _, err = md.Process(cfg, reqPath, body, ctx) if err != nil { return err