File URLs change when pages are moved or made invisible

Yes but, what I am concern about is the content on the other pages that are still visible. If all their sequence numbers change as a result of me making a page above them invisible, then all of their content links are broken:

1_cat
2_dog
3_tree
4_milk
5_house
6_cactus

If I make tree invisible it shifts everything up

1_cat
2_dog
3_milk
4_house
5_cactus

Therefore breaking content links for milk, house, and cactus. This is important for Google indexing and incoming links from other websites and blogs.

Is there a way to control visibility without automatically effecting the sequence number? This is a major problem I am facing with the site structure.

No, Kirby never includes the sorting numbers in the URLs of pages. So Google won’t be affected if you sort pages.

Is it still the case for files uploaded to pages?

Kirby doesn’t include the sorting numbers in the outward facing page URL:

BUT IT DOES FOR THE CONTENT URL (images, pdfs, etc files)




So, if I decide to make one of these pages invisible, like “12-kingsboro” then the subsequent URLS will look like this:


http://www.withprojects.org/content/2-curation/12-museum-of-art-design/ilbaso.gif
http://www.withprojects.org/content/2-curation/13-nada-miami/00.jpg

Therefore this breaks the IMAGE URL. Google uses these URLS to index images, so if they break by adjusting visibility or even reordering the list, that is a huge problem that I would really like resolved.

I enjoy Kirby very much, but this is a very big issue especially if my clients are dependent on their content ranking and not breaking. They should have the ability to activate/deactivate their projects without this worry.

Any help would be appreciated.

For now you can do:

<?= $page->url() . '/' . $file->filename() ?> 

in your templates to get the static URL to the files. We might consider adding an option to make this the default if you have to have this.

6 Likes

We have seen this requirement more than once, so an option would be great :slight_smile:

3 Likes

It would be extremely useful and solves an integral problem with how the site works. This would be an essential update. Please please please consider this as an option.

I like using kirby, but for client work I have had to switch back to wordpress because of this very issue. There should be an easier way to active/deactivate pages without effecting content links elsewhere.

I look forward to the update!

2 Likes

Also, wanted to clarify.

I am not suggesting that you get rid of the numbering system or re-do the entire structure in which Kirby is built.

I am just suggesting that there should be a way to control visibility/invisibility and sorting without changing the sequence number that is assigned to the page upon it’s creation. The original numbers can definitely stay, as long as they stay fixed.

Thank you again, much appreciated.

1 Like

Well, if the numbers should be fixed, that would mean that we would get rid of the numbering system.

What Bastian proposed above is that we will provide an option that the file URLs without numbers are used, not an option to change the numbering system.

Have you tried Bastian’s code example? This should fix the issues you are having until we make this an option in Kirby.

1 Like

Yes, fixed numbers would not even make sense, because it would disable the possibility to change the order of pages.

The This can be implemented as a file object method, too—

kirby()->set('file::method', 'safeUrl', function ($file) {
  return $file->page()->url() . '/' . $file->filename();
};

Untested, but should make this a little cleaner in your templates!

1 Like

Unfortunately, this does not help when you use images in text area fields … So we would need a solution that takes care of those images as well.

Do you mean inside Kirbytext? Yes, that’s true. I think we should just add an option that will then be checked in $file->url() directly. Then it works everywhere.

Yep, that’s what I meant.

It was proposed to Add an underscore, instead of removing the number, which sounds like a good idea imho.

1 Like

I agree to this great idea.

But what’s about in an older post about needing a new request for this?

Is this a real and serious problem with Kirby’s core structure/underpinnings?

No. As we wrote above, Kirby already supports file URLs without the sorting numbers. :slight_smile:

This doesn’t seem to work for multi language websites. It only works in the default language and throws 404 errors in the other languages.

Is this normal or am I doing something wrong?