aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/content/en/functions/strings/CountWords.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/functions/strings/CountWords.md')
-rw-r--r--docs/content/en/functions/strings/CountWords.md31
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/content/en/functions/strings/CountWords.md b/docs/content/en/functions/strings/CountWords.md
new file mode 100644
index 000000000..e6915e6cd
--- /dev/null
+++ b/docs/content/en/functions/strings/CountWords.md
@@ -0,0 +1,31 @@
+---
+title: strings.CountWords
+linkTitle: countwords
+description: Counts the number of words in a string.
+categories: [functions]
+keywords: []
+menu:
+ docs:
+ parent: functions
+function:
+ aliases: [countwords]
+ returnType: int
+ signatures: [strings.CountWords INPUT]
+relatedFunctions:
+ - len
+ - strings.Count
+ - strings.CountRunes
+ - strings.CountWords
+ - strings.RuneCount
+aliases: [/functions/countwords]
+---
+
+The template function works similar to the [.WordCount page variable][pagevars].
+
+```go-html-template
+{{ "Hugo is a static site generator." | countwords }}
+<!-- outputs a content length of 6 words. -->
+```
+
+
+[pagevars]: /variables/page/