getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.27k stars 167 forks source link

UUID to page conversion doesn't work when paginated, and `url` set in config #4860

Closed n-kort closed 1 year ago

n-kort commented 1 year ago

Description

Using page('page//example-uuid'), or $field()->toPage() on paged templates results in this error:

Screenshot 2022-11-22 at 19 11 37

I'm using a structured field for menu settings in the site.yml, and when trying to loop through it in the template this happens. Specifically, any URL with /page:[n] after it.

While investigating I tried changing the 'url' settings in the config.php, turns out this happens when 'url' => '/', which I had set as a fix for mixed content warnings on the server.

Expected behavior
The methods should work the same on /news and /news/page:2 etc etc

To reproduce

  1. Set 'url' => '/' in your config
  2. Add page('page//any-uuid') to a template
  3. Go to eg /news/page:2
  4. See error

Your setup

Kirby Version
3.8.2 php 8.1

lukasbestle commented 1 year ago

I cannot reproduce this issue in the Starterkit with the steps you explained.

Is the missing colon (page// instead of page://) a typo or is this the actual code you used? In this case, please ensure you add the colon, otherwise the page lookup won't work.

n-kort commented 1 year ago

Hmm, no the colon I guess was irrelevant since the IDs were mainly coming from structured fields... but I can't reproduce it again either 😬 I must have changed something else or misidentified the source of that error.

Thanks for looking into it @lukasbestle, I'll close and test more in Starterkit if it crops up again!