Password protect a post/area in website

Is there a way to restrict access to certain areas of the website, and keep for example, certain posts private, so that it’s only visible after entering a password or other security measure.


Not built into Hugo, but you could put .htaccess file(s) into /static.

Good idea, thanks.


@Paul_Reed Agreed there is no reason to build this into an SSG (since its technically a different thing). I recommend Heroku or, if you’re looking for a less technical solution, Netlify makes password protection easy…

We make a tool to help user to encrypt their article content of Hugo.


Maybe you can have a try!

Just had a look at your code.

IMHO you could improve it by using the Hugo translation of strings function i18n instead of hardcoding strings in shortcode.

1 Like