Add this snippet to each page under docs/ that you want gated.
Drop gate.js at the root of your repo (same folder as index.html and cards.json), then add this as the very first thing inside <head> on each doc page:
<script src="/gate.js"></script>
A minimal locked page looks like this:
<!doctype html> <html lang="en"> <head> <script src="/gate.js"></script> <meta charset="utf-8"> <title>My page</title> </head> <body> <h1>Hello</h1> </body> </html>
When a visitor without a token hits docs/foo.html, gate.js hides the page and redirects to /index.html?next=/docs/foo.html. After they authenticate here, they're bounced back to the page they wanted.
The src="/gate.js" path assumes your site is served at the root of the domain (true for a custom domain like saiz.ws). For a project site at user.github.io/repo/, use a relative path like ../gate.js instead.
Not real security. This is a UX lock only — the raw HTML of every file in your repo is publicly readable on GitHub. Don't put anything actually sensitive in docs/.
What's changed in each version of this page.