Kill the current menu system

Ok then. That might work.

But why not just simply remove this order number from slug and put the order and visibility values inside the text file? like this:

Title: 30 Days

----

Text: blah blah

----

Order: 4

----

Visible: yes/no

+1

I thought of that possibility as well. When I think about it I really like it this way. The panel generates this content anyway and if I want to use order numbers, why not put them there as well.

Just a few things here…

Visibility should be false by default

If visibility is not in the content, it should be false. When not using menus or order numbers, it should not take up space.

Visibility: true

When true it’s used. I like true / false better because they are logic like PHP.

Should we prevent collisions?

If someone uses order or visible for something else they are overwritten. Should we prevent things like that? Maybe prefix it with something like…

Kirby-order:
K-order:
Page-order:
Menu-order:

It does not look as nice as order but I think we should have this possible problem in mind.

Because Kirby would need to read the YAML content of all the files, instead of just the folder names. That would slow things down massively.

2 Likes

It that really so? It will not be a big difference to doing this, right?

$items = $page->children()->filterBy('visibility', 'true');

Then the indications could be defined in the parent folder’s text file:

Visible-children: about, projects, contact, 30-days

And by doing so we are going to lose the ability to see what is hidden and what is shown just by looking into the folder structure. then you need to check all the folders and see if their name is in the parent’s textfile. It’ll be a mess with 20+ pages, when only 2/3 of them are shown.

1 Like

How important is it to be able to see visible pages in the folder structure? You don’t see the other fields there.

slug is the only thing I think is important to see in the folder structure (except for modified and created). The rest is just meta.

Why not just use thirty-days instead of 30-days?

Sure, but you can’t always re-write the title. It can work for posts, but not for other types of content. Sometimes you have to use existing names that will result in a problematic slug:

Album names: 1995-2015 Greatest Hits
Song titles: 10:15 Saturday Night
Film titles: 9½ Weeks, 8 mile

Some titles are not as effective when you don’t use digits:
Linkbait titles: 12 heart-breaking ways to incentivize drunk giraffes you won’t believe
Dates: “2030, the next frontier” works better than “Two thousand thirty”.
Figures: “95% of people do this”. I can’t imagine the author writing “Ninety five percent do this”.

1 Like

are we talking about titles? or urls? i never include numbers in my urls, in your example I would use “people-do-this” as my slug and leave the title alone.

Yes, but when you create a page and put a title, the title becomes the slug.

As @texnixe wrote, in the Panel titles are converted to URLs automatically. So “10:15 Saturday Night” would become “10-15-saturday-night” and break ordering. Users can edit the slugs, but they don’t have to.
I think letting them do something that can break the site is a problem. I’d like a solution that Just Works™ and don’t put the responsibility on the user.

Removing leading numbers would work. I have a feeling that some won’t like it for SEO reasons, but I personally don’t mind, URLs are locators, not titles after all.

I still like what I suggested earlier: if the title begins with numbers, either remove the dashes after them

1995-2015 Greatest Hits -> 19952015greatest-hits
10:15 Saturday Night    -> 1015saturday-night
9½ Weeks                -> 9weeks

or replace them with underscores if we want to keep URLs legible (pretty much what @jenstornell suggested before me)

1995-2015 Greatest Hits -> 1995_2015_greatest-hits
10:15 Saturday Night    -> 10_15_saturday-night
9½ Weeks                -> 9_weeks

Well I guess that’s where I am different than some, I always edit my urls, none of mine are usually no more than 4 words. They are easier to remember and don’t tie my content to the url.

In your example your missing a good opportunity to inject some long tail keywords as you mentioned SEO as well as make them more obvious as to the content.

If I was writing those urls I would almost certainly just rewrite them to:

1995-2015 Greatest Hits -> band-name-1995-2015-greatest-hits
10:15 Saturday Night    -> band-name-1015-saturday-night
9½ Weeks                -> band-name-nine-and-a-half-weeks

If i’m writing a list like 15 Tips On Shortening Your Urls

15 Tips On Shortening Your Urls -> short-urls

I never tie my urls to quantity, what happens if I want to rewrite that to 20 tips in 6 months?

For an absolute title like 30 Days

30 Days -> thirty-days

would be totally acceptable IMO.

You can edit your urls and I personally think people should be anyways,

For example, on your blog you have a url

i-am-a-kirby-addict-10-plus-reasons-why-kirby-2-is-worth-more-than-a-try

If I wrote that I would simply write my url as

why-kirby-2

Its easier to remember and easier to share, your full url takes up 104 characters, my version takes 41.

In my opinion, it’s not so much a question of what you or I do, but the problem is what sort of problems our clients might run into when creating a new page. I’m not saying you shouldn’t edit your URLs, but maybe your clients or any editors just won’t do it and you can’t count on it. Also, other people have different preferences and ways they handle things.

1 Like

If I’m reading correctly, that’s not what @jenstornell proposed. He proposed that we replace the visibility delimiter to be an underscore instead of a dash, for all pages. So:

visible:   1_1995-2015-greatest-hits
invisible:   1995-2015-greatest-hits

visible:   2_about-us
invisible:   about-us

That said, I actually prefer your solution, mainly because it doesn’t change the status quo for pages that don’t start with a number:

visible:   1-1995_2015_greatest-hits
invisible:   1995_2015_greatest-hits

visible:   2-about-us
invisible:   about-us

I also agree that @Malvese is a better solution because it would be fully backward compatible. However I want to add some things here, just to make everything clear.

Visible folder name

The underscore is just a safe way for Kirby to determine where the order number is. Therefor I think that only the first slug number should have an underscore after it, like this…

1-1995_2015-greatest-hits-30-days-from-now

Why it works

  • It will then know that 1 is a order number, because it’s a number with a hyphen directly after it.
  • It will know that 1995 is a part of the slug because it’s a number with a underscore directly after it.
  • It will know that 2015 is a part of the slug because there is a underscore somewhere before it.

Visible output slug

It would print the perfect slug. The order number will be parsed out because it’s only an order number. The underscore should be replaced with a hyphen…

1995-2015-greatest-hits-30-days-from-now

Invisible folder name

1995_2015-greatest-hits-30-days-from-now

Invisible output slug

1995-2015-greatest-hits-30-days-from-now

Never print underscores in the slug. Underscore should be replaced with a hyphen when in the slug.

My summery

We would have the perfect slug and close to the perfect folder name. It would be fully backward compatible and work much better than it does now, expecially in the panel.

I’ve tested this approach a bit right now, and it works well even right now. The only problem there is, that _ are still _ in the url.

Rewriting those is a more problematic. You need to fix the url creation within kirby. Especially $page->uid() will be returning 1995-2015-greatest-hits-30-days-from-now from the folder name 1-1995_2015-greatest-hits-30-days-from-now instead of 1995_2015-greatest-hits-30-days-from-now (See the _ after 1995).

Internally Kirby relies a lot on $page->uid() for moving and hiding pages. It would require some tweaks for it. There might be some problems with linking assets. :slight_smile:

Tagging @bastianallgeier for his opinion on all this.

But that won’t solve the ordering issue if the band’s name is “50 cent” :stuck_out_tongue_closed_eyes:

@samnabi
Yes, I misread @jenstornell’s post. Also he is right that only the first dash needs to be replaced. It just seemed weird to me that only the first of several numbers was followed by an underscore.
For the record, I still don’t like that my approach mixes different separators in the slug but I haven’t found a better solution.

Another way would be to prepend any leading number with a dash (or any other safe char: _.!()*'):

10:15 Saturday Night  -> -10-15-saturday-night
  -> http://mysite.fr/-10-15-saturday-night     // ugly URL :(
With ordering        -> 3--10-15-saturday-night // also ugly

So far the only non-ugly way I see would be the use of an optional different order separator set in config (again, one of _.!()*'). There may be a good reason why the dash has been chosen though. Which one is the most legible?

3_10-15-saturday-night
3.10-15-saturday-night   // liking this one
3)10-15-saturday-night