github-pages-jekyll-password-protection

GitHub Pages/Jekyll Password Protection

Automatically password protect (with encryption) certain pages on GitHub Pages/Jekyll sites using PageCrypt.

Demo

This repository serves as an example repository for password protecting pages. See example.html (password: examplepassword) and example-2.html (password: repo_by_evanbaldonado.com!).

Usage

  1. Configure passwords for .html pages in _protected_pages.txt.
    • Add one file per line (space-delimited in the format filename.html password).
    • Note that GitHub converts markdown (.md) files to .html files.
    • Because this file begins with an underscore, it will not be published when your site is deployed.
  2. Add a GitHub action/workflow for encrypting pages: /.github/workflows/pages-with-encryption.yml.
    • Make sure that it targets the correct branch you want to use for deployment (see line 6: branches: ["main"]).
  3. Automatically deploy this repository with GitHub Pages using GitHub Actions: Settings > Code and automation > Pages > Build and deployment > Source > Github Actions. You can manually run this Action; it will also automatically run when you update your repository.

Security

License & credits

This repository by Evan Baldonado is published under the AGPL-3.0 license. It utilizes PageCrypt by Samuel Plumppu (a complete rewrite of Maximillian Laumeister’s original code).

Contributing

Feel free to submit issues/pull requests!

Contact

You can start a discussion on this repository or contact password@evanbaldonado.com with questions. The PageCrypt repository also has additional information about the encryption process itself.