EDIT: There is a known issue about wordcount and autogenerated summaries for CJK languages. I added the RuneCount method a while ago, but there is an open discussion about it on GitHub.
The problem is with looping through the pages in the shortcode. If I put this code in my template file, it works correctly:
{{ range $.Site.Pages }}
{{ .Title }} - {{ .WordCount }} - {{ .FuzzyWordCount }} <br/>
{{ end }}
$.Site.Pages can, however, not be used in a shortcode and triggers the *Data is not a field of struct type hugolib.ShortcodeWithPage error message. I know of pages and nodes, but not of the ShortcodeWithPage type.
So how to access all pages in a shortcode correctly?
You can not. This isn’t what the shortcodes are built for. This is the chicken and the egg; it should be documented better what part of the page’s state and the site’s state that is available in the shortcode – but the surrounding content isn’t.
Thanks for clarifying Bep. Is there a particular reason why we can’t pull .WordCount in a shortcode but variables like .Title, .IsDraft, .Section, and .Params.categories are no problem? Or is this latter something that will be deprecated in future versions since shortcodes aren’t built for that?