retypeapp / retype

Retype is an โœจ ultra-high-performanceโœจ static site generator that builds a website based on simple text files.
https://retype.com
Other
1.02k stars 201 forks source link

Option to Password Protect the Entire Page #599

Open p0fi opened 10 months ago

p0fi commented 10 months ago

๐Ÿ“– Description

Currently it's possible with Retype to password protect single pages or folders by setting the visibility property to protected.

It would be useful option to protect the entire page with a password so that viewers without a password can't even see the navigation.

๐Ÿ”Ž Details

Ideally this setting could be controlled via a CLI parameter like the actual password (RETYPE_PASSWORD) or the secret (RETYPE_SECRET) or an environment variable.

Maybe something like RETYPE_PAGE_PROTECTED=true

It could also be part of the project configuration in retype.yml for example

input: .
output: .retype
url: example.com # Add your website address here
branding:
  title: Project Name
  label: Docs
links:
  - text: Getting Started
    link: https://retype.com/guides/getting-started/
footer:
  copyright: "© Copyright . All rights reserved."
visibility: protected
geoffreymcgill commented 10 months ago

I might be missing something here and you might need to provide additional details or description of your requirements.

How about setting visibility: private on the page?

p0fi commented 10 months ago

This approach has the following problems:

  1. The inclusion of the visibility: private setting is required for all pages, although it is not a significant concern.
  2. The page will not appear in the left navigation. Doing this to all pages would result in an empty navigation bar.
  3. When operating the page in development mode while editing, it is required to include the password argument (RETYPE_PASSWORD=xxxxx or --password flag) when executing the CLI command (retype start). This requirement prevents the local execution of the command for editing purposes unless a password has been set. Therefore I am required to frequently input the password while working on the page. Ideally, I would prefer the ability to work on it locally without requiring a password, and subsequently deploy it on GitHub Pages with password protection. The management of this can be effectively achieved through the utilization of an environment variable or build flag within the Github action responsible for the construction and deployment of the page.
geoffreymcgill commented 10 months ago
  1. Setting the visibility on each of the pages or folders is currently required. We do have a plan to implement a defaults project config that will allow for setting the default page config values. There is no time line for the release of defaults, but it is a priority.
  2. Setting layout: central on the Page is one option to hide the left tree navigation.
  3. There should be a way to get the RETYPE_PASSWORD Environment variable working during retype start when running locally. I will try.

Hope this helps.

geoffreymcgill commented 10 months ago

It seems like you might be looking for more of a site-wide password protection option? If you are using Cloudflare, I believe they have an option or plugin to password protect an entire website or maybe even just a portion of website.

p0fi commented 10 months ago
  1. Setting layout: central on the Page is one option to hide the left tree navigation.

I would like to clarify that I would want the navigation to be accessible to users who possess the password, while excluding access to it for users who do not possess the password. Basically having a password set for the entire project not only single pages.

  1. There should be a way to get the RETYPE_PASSWORD Environment variable working during retype start when running locally.

The functionality functions properly when the environmental variable is set. However, in the absence of this variable, attempting to initiate the retype start command results in the occurrence of the following error.

ERROR: [folder/page.md] No "password" project-level option is configured for private pages.

The outcome is a 404 page exclusively due to the password protection implemented on every page within the project.

p0fi commented 5 months ago

It seems like you might be looking for more of a site-wide password protection option?

Yes ๐Ÿ˜ฌ But im not using Cloudflare or anything similar. It would be cool if Retype had this feature. Would maybe also somehow solve #679 as I currently need to set every page to protected which basically disables search.

p0fi commented 2 months ago

Any news on this topic? ๐Ÿ˜‡