How to password protect my Hugo site?

I tried using .htpasswd/.htaccess and that did not seem to work…

Anyone have suggestions on how to put a simple password/auth on a Hugo site?

To my knowledge, these don’t work on Replit. To make a password-protected site, you’d need to use a backend such as Flask or NodeJS (using only a frontend prevents you from storing secret info like passwords). Also, I’m not sure that ReplAuth works on an HTML/CSS/JS Repl. I think you need a backend for that too.


Thank you for the prompt and helpful/confirming reply!!!

Interesting… so I guess the next (or real) question becomes… how to add a little bit of “back-end” to a Hugo site?

Please explain what you mean by “Hugo site”? A site made by @hugoondev?


A Replit site created using the “Hugo” template, for instance. (but I guess in the end… not limited to that… but that is what I am starting with right now)

I had no idea that existed. Here’s the link by the way (for anybody else reading this thread). That template does allow usage of a Replit DB and Replit Secrets, so I suppose it’s possible. It seems to me that this template is designed for ease of use, not modularity, so I doubt you’ll be able to easily add extra features.

I suggest one of three things:

  1. Use a different template, one which is not as user friendly but easier to add features to (such as the aforementioned Python Flask and NodeJS).
  2. Make the Hugo Repl private then embed the Hugo website in a password-protected website using an iframe. This would only provide basic protection as anybody looking at the second site’s source code would be able to easily find the Hugo site’s URL. Note that even if you use a Secret to store the URL, it will be publicly availible because it will render in the HTML when you visit the website. Nevertheless, the average web user doesn’t disect source codes.
  3. Get help from someone not me.

Thanks again for quick and helpful reply! Thanks for putting the link to the template!

Option 1 is very interesting… I mean one of the points of Hugo is to make a simple static website… but being able to use Flask or NodeJS to with Hugo would really expand the usefulness of Hugo!

Option 2 is also nice to know about… a nice option for some simple “light security”

Option 3 - LOL! Nice! ( I tend to offer that as my last option for people I help too! )

Thanks again!!!

LMAO, no Hugo is a framework

1 Like