Hugo

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.

Paul

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

Good idea, thanks.

Paul

@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.

Hugo-Encryptor

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