Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add authentication for certain pages of Jekyll site

I have a certain page my Jekyll site that I only want to make available to people from my organization's domain (call it example.com).

Am I correct in my understanding that it's not possible to restrict access to certain pages because — as is the nature of a static site  — everything has already been served at once?

I'm aware of the jekyll-auth plugin to authenticate users against GitHub, but my situation would require that authentication through Google sign-in.

like image 553
charliesneath Avatar asked Dec 18 '15 17:12

charliesneath


1 Answers

Jekyll is just a static site generator, so anything related to authentication will depend on what you have available on the webserver that is hosting the site.

Take a look at the Jekyll Google Auth plugin for example: https://github.com/apcj/jekyll-google-auth

It's basically a trick... Anytime a request comes in for a page, they run it through Sinatra (using the _site folder as the static file folder, just as public would be normally), and authenticate it using apcj/sinatra-google-auth.

So in this case, you know that your webserver must have Sinatra for this authentication method to work.

like image 133
C. Augusto Proiete Avatar answered Oct 14 '22 04:10

C. Augusto Proiete