Login form for Jekyll site

I’m curious if anyone here has figured out how to implement a login form for a membership section of a jekyll website. Since there isn’t a database, how can a login form (with a username and password) be used to limit access to a specific area of a Jekyll website? Thanks a bunch for helping!!!

You have to play with basic authentication:

However to register the user you need some sort of server-side script, let’s say PHP:

  • to generate the password in the auth file directly;
  • to send an email to a specific address that can be read from a script in your local server that parses the message and generates & loads the auth file (in that case also Javascript in place of PHP might be a good solution).

You may play with something like mod_oauth2 or mod_auth_openidc for apache to delegate the authentication to an external openid/oauth2 server (did not try, I’ll let you dig in ;))

1 Like

MongoDB (the company) has a product, MongoDB Realm, that can handle user authentication for static sites. It used to be called MongoDB Stitch.

I tested it extensively a few years ago on a large Jekyll site, and it fit my use case perfectly. That project used MongoDB upstream of the Jekyll build, so the decision was easy. It also has a decent free tier. It may be far more than you need though (see basic auth suggestions above).

The Realm ecosystem has grown considerably since those early days - you want the Web SDK (link below).

I believe Netlify now has an Identity product, and I suspect several other JAMstack companies have jumped on the bandwagon as well. The search term you want to Google is “adding dynamic components to a static site”…add “authentication” to the end to drill down.