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>
This commit is contained in:
Avdhut 2022-09-02 09:37:52 +05:30 committed by GitHub
parent f2a7e7c966
commit 66959d9f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,6 +189,14 @@ func init() {
// {{.RespHeader.Set "Field-Name" "val"}} // {{.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` // ##### `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: // 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: