Setting to route all invisible pages to error page

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 Like

+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 :wink:

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.

3 Likes

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.

2 Likes

@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.

1 Like

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.

2 Likes

@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?