File URLs change when pages are moved or made invisible

Looking forward to exploring the new features but wanted to know if it addresses the visibility/invisibility issue I am facing:

When a page is deactivated or is invisible it doesn’t have a sequence number in its content URL:

Invisble:
http://url.com/content/section/page/image-01.pdf

Visible:
http://url.com/content/1-section/8-page/image-01.pdf

We have a long list of about 30 pages so if we deactivate it make invisible a page in the middle, like 15, then all subsequent pages that are visible shift up in their sequence number, leaving all content links that may have been indexed by Google broken.

Is there any way to control the visibility of a section/page without disrupting the content URL?

Any help would be greatly appreciated. Our small business depends on our images ranking.

Thank you in advance

1 Like

You can always access files with the direct URL of the page and the filename. So even if the page is invisible, the URL http://url.com/section/page/image-01.pdf should be working.

1 Like

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?