Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 14:15 UTC
templates: Document `httpError` function (#4972)
* added the httpError function into the document * Update templates.go * Update templates.go * Fix gofmt Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Avdhut committed
Sep 2, 2022 at 09:37 UTC
66959d9f18768beb9531d51241978731bff8a305
1 file changed
+8
modules/caddyhttp/templates/templates.go
+8
@@ -189,6 +189,14 @@ func init() {
189
// {{.RespHeader.Set "Field-Name" "val"}}
190
// ```
191
//
192
+// ##### `httpError`
193
+//
194
+// Returns an error with the given status code to the HTTP handler chain.
195
+//
196
+// ```
197
+// {{if not (fileExists $includedFile)}}{{httpError 404}}{{end}}
198
+// ```
199
+//
200
// ##### `splitFrontMatter`
201
//
202
// Splits front matter out from the body. Front matter is metadata that appears at the very beginning of a file or string. Front matter can be in YAML, TOML, or JSON formats: