"Hidden" parts of a website

Let’s say I have a Netlify website on a custom domain example.com.

Now, I’d like to hide some part of that website to public users. For e.g., I’d like example.com/blah to only be accessible for logged in users. (They could be logged in via Netlify, Google or whatever.) Everything else on example.com should be publicly accessible.

Is there any (preferably free) way to do that?

(Note that I am using Hugo as an SSG.)


You can use Netlify Identity’s Role Based Redirects: https://www.netlify.com/blog/2019/01/31/restrict-access-to-your-sites-with-role-based-redirects/

Thanks for the help.

Unfortunately, I don’t have a Teams Business plan. Any other ideas possibly?

Maybe this: https://www.netlify.com/blog/2018/01/23/getting-started-with-jwt-and-identity/

It’s basically the same thing, but this one doesn’t mention about requiring a Business plan (probably). So I think it’s safe to try.

Thanks again, I’ll check it out.