diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2022-12-07 11:29:15 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2022-12-07 11:29:15 -0500 |
| commit | 69a3d0123be4c645d5318b5e9d0a5e68f6324b58 (patch) | |
| tree | bb45de12a811b2f9aa135c7d7af825754291c259 /page/renderJson.go | |
| parent | 10c60b3c9ba2c17419534cf4089328a66568e4f1 (diff) | |
| download | go-website-0.0.20.tar.gz go-website-0.0.20.tar.xz | |
Add basic string functions to default template funcmap. Set a var when page is being rendered markdown only.v0.0.20
Diffstat (limited to 'page/renderJson.go')
| -rw-r--r-- | page/renderJson.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/page/renderJson.go b/page/renderJson.go index 52e707d..9359b69 100644 --- a/page/renderJson.go +++ b/page/renderJson.go @@ -66,6 +66,13 @@ func RenderJson(w http.ResponseWriter, r *http.Request, } if r.URL.Query().Get("markdown") == "1" { + if p.Vars != nil { + p.Vars["RenderingMarkdownOnly"] = true + } else { + p.Vars = map[string]interface{}{ + "RenderingMarkdownOnly": true, + } + } // Tossing the error, since it would've been revealed above md, _ := p.GetMarkdown() out["Markdown"] = md |
