Add Word Count & Estimated Reading Time to Posts
It’s all the trend these days to add “reading time” or a word count on your blog posts to indicate how big they are. We often add a word count as it’s super easy to add to your Hugo site (except we don’t on this site - oops!) Word Count We can use word counts in our theme template. We’ve shown the likely file below, but might change based on your theme and setup.
Check If a Page Is the Home Page
When writing and changing Hugo templates you will often want to act differently based on whether the page you are looking at is the home page, or any other page. So the post pages, contact, about etc won’t have this content show.
Only Show HTML When on Local/Production
For Hugo Themes, you will sometimes want to act differently between you working on the site, developing it, and the site if it’s running publicly on the internet. One example of this is if you show advertisements - you don’t want them showing on local (and contributing to impressions) but you would want to show them to the world. The reverse is also true, you could load scripts like livereload only on local development, through hugo server.