What would you think about an optional config setting that would re-route all invisible pages, if accessed directly through their url, to the error page?
+1
maybe with a list of excludes?
At the moment an invisible page means only, that it is not listed in the menus.
So they can be linked on a visible page in the panel.
That is fine.
I have no idea how your comment relates to an optional setting? Iām quite aware of the current functionality of (in-)visible pages.
@Jan yea, excludes (similar to excluding pages from caching) would be helpful indeed
The Title is:
Setting to route all invisible pages to error page
I donāt agree a setting āonly for all pagesā.
If, then it should be set in the blueprint, not in the config! That would me more locally for every blueprint type.
At the moment, the admin could get this in every template file or in the header snippet:
for details look at
Protecting Content
Arenāt blueprints only parsed when in the panel? When a URL is browsed on the front end, I think the content goes through a template, but not a blueprint.
But yeah, an option to exclude whole blueprints from being redirected is interesting.
I like the idea of a global setting, most of the times we donāt want invisible pages to be browsed imho.
If it would be per blueprint (which isnāt possible, they are only used for the panel, Iād assume you mean per template), you can simply do that in the respective template. I simply donāt see why it should be better, as you suggest, to have the need to add a redundant piece of code to every template, compared to an optional setting - which means you can simply not switch it on and you donāt have to care about it at all.
Btw: itād be still better to set up a route, which can be done. But what Iām asking here is if others would feel the need to have an optional setting for this already implemented in the core. I see, that you donāt, but Iām curious to hear, what others think (like @Malvese). Itās not that I wouldnāt know how to implement this
This optional setting would be really helpful for invisible pages that you donāt want published yet, like blog posts etc.
I agree with @Jan that an array of excludes would make perfect sense for those pages that you donāt want to mark as visible but still publish (I often use invisible pages for imprint and privacy pages and the like that I donāt want in the main menu).
So +1 from me as well.
Judging from the posts in this forum, it seems to me that invisible files being browsable is a frequent misunderstanding. Itās a bit unintuitive to be honest. Sure the wording is visible/invisible, and not public/private, but I believe there is this natural expectation that invisible pages cannot be seen by regular visitors. If itās invisible it canāt be seen, right?
Perhaps itās just a wording issue.
Anyway, this option (that could be the default behaviour imho) has the potential to avoid diving into authentication and routes for a lot of people. It would make Kirby a lot easier to use, especially for the less tech-savvy.
I totally agree, @Malvese
For my project Iām still thinking about the solution to add a checkbox āhide in menuā to all of my pages and consider this in the menu snippet. With the advantage to be able to hide visible (and because of that also sortable) pages in the menu.
Maybe the wording for āpublic/privateā pages could be like in Drupal, where pages can be āpublished/unpublishedā.
ā¦ is wrong.
Look at my post above or at
Visible and invisible pages
in the docs:
Invisible page
/content/terms-of-service
/content/imprint
You can use the distinction between visible and invisible pages in
your templates to only show visible pages in a menu for example.
Invisible pages are still accessible via their URL.
You can add in the top of your header snippet:
<?php if(!$page->isVisible()) go('error') ?>
But now the error page must be visible!!!
If you do this, you donāt need this setting!
@HeinerEF: @Malvese was talking about what people assume āinvisibleā means, because the posts in this forum show that there is some misunderstanding. We all here know how visible and invisible pages work and @distantnative is trying to find a way to make invisible pages really invisible with an optional router that makes it easy for the not-so-tech-savvy.
You may rest assured that @distantnative knows what he is doing.
@texnixe:
Yes, you are right.
They talk something, that at the moment is a using of Kirby, that is different from the Kirby docs.
Look at the big link in my last post!
@HeinerEF This post is not about the docs, so I donāt see why you link to the docs. This post is about a suggestion (āWhat would you think ā¦ā) and an invitation to discuss the pros and cons. No need to get all upset.
I think the discussion here should be:
- change the name invisable pages to something other
or - add an property to make an existing page invisable.
But I disagree to change something against the docs of Kirby! That would be terrible for Kirby newcomers.
Donāt you think the router can be coded in a way to āknowā that the error page - while āinvisibleā - must still be accessible (or the home folder, for that matter)?
Well, documentation is here to document a current state of something. So usually, we change the documentation whenever the product it documents is changed. Itās not a document about how something will be forever. Otherwise there would be no chance of progress.
@texnixe has pretty much said everything - only once again: we are talking about an OPTIONAL setting. newcomers wouldnāt know, wouldnāt need to care, would be totally fine.
So could you just let us, the people who are interested in such a possible solution, discuss how this would be done best, please? We got that you arenāt a fan of this.
If the admin follows:
no optional change is needed!
You can changeā¦
[added:]
If you add:
<?php if ((!$page->isVisible()) && ($page->uri() <> 'error') && ($page->uri() <> 'login')) go('error') ?>
the error page and the login page can be invisable.
Alright, so how would this ideally be implemented?
c::set('something', true);
-> all invisible pages (except home
and error
) canāt be accessed directly, but will redirected to error
and to exclude some invisible pages from this
c::set('something', array(
'search',
'speakers/*'
));
More ideas, thoughts on this?