countwords.md (560B)
1 ---
2 title: countwords
3 description: Counts the number of words in a string.
4 date: 2017-02-01
5 publishdate: 2017-02-01
6 lastmod: 2017-02-01
7 categories: [functions]
8 menu:
9 docs:
10 parent: "functions"
11 keywords: [counting, word count]
12 signature: ["countwords INPUT"]
13 workson: []
14 hugoversion:
15 relatedfuncs: [countrunes]
16 deprecated: false
17 ---
18
19 The template function works similar to the [.WordCount page variable][pagevars].
20
21 ```
22 {{ "Hugo is a static site generator." | countwords }}
23 <!-- outputs a content length of 6 words. -->
24 ```
25
26
27 [pagevars]: /variables/page/