bnomei / kirby3-boost

Boost the speed of Kirby by having content files of pages cached and a fast lookup based on uuids
https://sakila-with-boost.bnomei.com/
MIT License
51 stars 0 forks source link

Structure items with BoostID #4

Closed psntr closed 2 years ago

psntr commented 2 years ago

Hello!

It's me again, after being able to transfer my project from autoID to BoostID, I wanted to know if BoostID is compatible with a structure object?

I'm trying to have a page where there is a structure called "Categories" with inner fields that contains a title and the BoostID, for exemple:

categories:
    type: structure
    translate: false
    columns:
      color:
        width: 1/4
      category:
        width: 3/4
    fields:
      category:
        label: Category
        type: text
      boostid: fields/boostid

This page is unlisted but still has a models page in order to use BoostID. Nevertheless, I'm not able to create the ID's via:

kirby()->impersonate('kirby');
site()->boost();
// or this
foreach(site()->index(true) as $page) {
   $page->boost();
}

Before I had autoID for each of the structure items and I could use the immutable ID's to retrieve the title of the category or change it without breaking all articles related to this category.

Would appreciate a hint or how to achieve that with structure object.

bnomei commented 2 years ago

boost has no support for ids inside structures.

if you "just" need each structure item to have an unique id consider enforcing your own logic in an page.created/updated hook. see forum on how to update structures.

bnomei commented 2 years ago

or consider using very simple blocks. they have a id built in which you could query and reference somewhere else.

psntr commented 2 years ago

Thanks for the quick reply. That's a pity, it was so nice to have that feature in autoID.

I will try with page.update hook to keep the structure as it is, but using the blocks option it's also interesting idea.