mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-14 16:49:35 -04:00
1.0 KiB
1.0 KiB
title | description | categories | keywords | params | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PlainWords | Calls the Plain method, splits the result into a slice of words, and returns the slice. |
|
The PlainWords
method on a Page
object calls the Plain
method, then uses Go's strings.Fields
function to split the result into words.
Note
Fields
splits the strings
around each instance of one or more consecutive whitespace characters, as defined byunicode.IsSpace
, returning a slice of substrings ofs
or an empty slice ifs
contains only whitespace.
As a result, elements within the slice may contain leading or trailing punctuation.
{{ .PlainWords }}
To determine the approximate number of unique words on a page:
{{ .PlainWords | uniq }} → 42