mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'
This commit is contained in:
28
docs/content/en/methods/page/Plain.md
Normal file
28
docs/content/en/methods/page/Plain.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Plain
|
||||
description: Returns the rendered content of the given page, removing all HTML tags.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/page/Content
|
||||
- methods/page/RawContent
|
||||
- methods/page/PlainWords
|
||||
- methods/page/RenderShortcodes
|
||||
returnType: string
|
||||
signatures: [PAGE.Plain]
|
||||
---
|
||||
|
||||
The `Plain` method on a `Page` object renders markdown and [shortcodes] to HTML, then strips the HTML [tags]. It does not strip HTML [entities]. The plain content does not include front matter.
|
||||
|
||||
To prevent Go's [html/template] package from escaping HTML entities, pass the result through the [`htmlUnescape`] function.
|
||||
|
||||
```go-html-template
|
||||
{{ .Plain | htmlUnescape }}
|
||||
```
|
||||
|
||||
[shortcodes]: /getting-started/glossary/#shortcode
|
||||
[html/template]: https://pkg.go.dev/html/template
|
||||
[entities]: https://developer.mozilla.org/en-US/docs/Glossary/Entity
|
||||
[tags]: https://developer.mozilla.org/en-US/docs/Glossary/Tag
|
||||
[`htmlUnescape`]: /functions/
|
Reference in New Issue
Block a user