Skip to content

Commit

Permalink
templates: Document httpError function (#4972)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Malankar and mholt authored Sep 2, 2022
1 parent f2a7e7c commit 66959d9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/caddyhttp/templates/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ func init() {
// {{.RespHeader.Set "Field-Name" "val"}}
// ```
//
// ##### `httpError`
//
// Returns an error with the given status code to the HTTP handler chain.
//
// ```
// {{if not (fileExists $includedFile)}}{{httpError 404}}{{end}}
// ```
//
// ##### `splitFrontMatter`
//
// 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:
Expand Down

0 comments on commit 66959d9

Please sign in to comment.