Add Word Counter to Posts

In this post, we will see how can we get the statistics on the Word Counter for every blog post in Hugo - both in the Summary and the detailed page.

Disclaimer

Note: I use the Fuji Theme for Hugo.

I presume most of the configuration values should be common across all the themes. However, it is better to check with the theme documentation for the right way to get the data rendered and displayed correctly on the site, as the keywords used to display the data might be different in each theme.

Configuration in the config.toml file

The settings to be applied in the config.toml file is given below.

[params]  
  ....
  # true|false are the allowed and recommended values
  showWordCounter = true

Note:

  • The lines starting with a pound symbol # is a comment and generally used for the humans for better understanding.
  • Remember the string showWordCounter is a keyword and should be used as it is.
  • The configuration should be specified under the [params] section, for it to be effectively used in the rendering.

References

Cheers,
RM…
Raghavan alias Saravanan Muthu
16 Jun 2021 | Wed | 01 30 20 AM IST