Being able to control the access level of a post or page is very powerful, but what if I want to limit access to a static page, resource or path? I could modify the template code so that parts of the page aren’t visible to members that aren’t signed in, but that seems a little heavy-handed when really I just want to redirect members who don’t have access. In addition if the page is generated by Ghost or a resource there’s no template code to edit.
visibility key in the
routes.yaml we could set who is able to access that path and either redirect people who don’t have access or show an appropriate error message. This is merely an idea but maybe the syntax would be something along the lines of:
routes: /my-membership-only-route/: visibility: members
In this scenario my membership only route page is only available to members of my site. If the viewer is not logged in they will be greeted with an error page (unsure if this should be a 404 but something certainly similar).
routes: /my-membership-only-route/: visibility: paid redirect: /signin/
In this scenario my membership only route page is only available to paying members of my site and logged out viewers will be redirected to a sign in page.
I see this being very useful in several different ways. Personally I’d like to restrict some zip files from being downloaded from people who aren’t members of my site, and create a small set of digital downloads. However I understand that people won’t wan’t to be using the routes file to regularly add digital downloads, so maybe propagating the visibility to sub directories would be useful too? That way a whole directory could be paid access only.
I realise this isn’t a trivial addition, but I just wanted to share an idea that may interest people and could become useful in the future
Thanks for reading