Store references to pages by unique identifier?

I’m using a pages field to store authors (which are just plain old pages) in an article. Because the pages field stores pages as slugs, that means right now if I change the url of a page, the link to the author needs to be added again.

I already have a page model for the author page that returns all contributions of an author as a collection, so I guess I could use a page.changeSlug:before hook and change all author values on those pages. Just not sure about how this will behave in terms of performance.
Also I’m cross-referencing pages at a bunch of places throughout the entire site, so I’m wondering if it’s possible to entirely change the way that the pages field stores values, or if there exists some plugin already.

Thanks!

Nope, currently, all you can do is use a select field instead and make this store the AutoID (if you use @bnomei’s AutoID plugin).

There used to be a feature request for the pages etc. fields, don’t know where that’s gone.

Apart from the quick and easy solution with the select/multiselect field, your only option would be a custom field based on the pages field.

I’m using that plugin. Might play around with a multiselect field, but it would be nice to keep the pages field with its search bar and linked pages… Hopefully the site’s editors don’t make any typos in names :innocent:

I was also just looking for it and couldn’t find it. Does that mean that the idea is discarded or that unique, unchanging IDs are something that’s on the horizon for future updates of either Kirby or the AutoID plugin? If not, it might actually be worth considering a rebuild of the pages field in a custom plugin…

Aha, found something.

But can’t find it in feedback channel.

1 Like

@texnixe, if I may ask, are there any updates on this?

No, nothing new. I guess this will also get solved if and when we implement IDs for pages, files etc. natively.

Hey there :slight_smile: I was just wondering whether there’s any news on this. Also very interested in a solution of this one…

Thx!

my autoid plugin is working quiet well. you can use that.

a core solution is not to be expected in near future (~ before fall 2021): https://kirby.nolt.io/16

edited: ah this is not about having an autoid but not having to use a select field with a query. nevermind.

Still, you cannot use the pages field to store the autoid at the moment, but have to use a select/multiselect field instead or create a custom pages field.

yeah sorry. missed that part. :sweat_smile:

@bnomei, thx! Love your plugin, been using it since I came across it! But yes, as @pixelijn pointed out, would be nice to have the pages field possibilities.