Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make posts private in Hugo?

Tags:

blogs

hugo

I am looking for ways to make some of the posts on my blog visible only to myself but can't seem to this in Hugo.

Is there any way around this such as setting a password for certain posts?
Or is the feature supported but I just haven't found it?

like image 451
sshh Avatar asked Jul 31 '16 00:07

sshh


1 Answers

Since Hugo just generates the static HTML, the question can be widened to: how to password-protect any static content on the web server.

That's doable.

It depends what is your web server using: Apache or Nginx or something else.

In Apache case, set up password authentication via .htaccess. See tutorials like this.

In Nginx case, set up password on your server block section, see tutorials like this.

For other server (IIS?), google accordingly.


Some people will want to downgrade this question, but in my opinion it's very valid, for example, if you want to post portfolios, CV's and whatnot on your personal website and limit public access

Make a landing page on Hugo site, password-protect the URL and give visitors the password. Easy, fast and still static!

like image 185
revelt Avatar answered Sep 21 '22 12:09

revelt