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?