Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Has anyone found a good way to password protect a sub-folder/page of a vitepress docs site?

We’re currently using cloudflare for the purpose, but it breaks the JS on vitepress, which means things like the mermaid or plug-in and sidebar can’t load.

We’re use the MPA (multi page app) setting. SPA would mean everything is still actually bundled and sent to the user anyway.

Beyond that, haven’t had any issues with VitePress. Great product.



Did you consider posting an issue on GH?

my 2 cents: if you intend to secure the content then it cannot be delivered to the client, as in: you need to have a password/token protected endpoint.

If it's just for the visuals then I guess you can prepare a Vue module that will prompt for a password before showing the content, then wrap a content within it.

<PasswordProtected :password="'foobar'"> This content will be displayed only after providing a password </PasswordProtected>


> if you intend to secure the content then it cannot be delivered to the client

... In plaintext. You could maybe wrap a kdf and a webcrypto thing in a Vue component - decrypting on the client by deriving a key from a user supplied password.

It would almost certainly be a worse solution than basic auth on a normal web server...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: