Smart way to combine panel data with external data?

I have a function that fetches data from an external api and creates pages out of it, containing some fields. That way I have normal pages with fields and can use Kirbys functions, as normal.

Add extra field data

Now I want to add a little extra data to each page manually with the Panel. If I do that on the same page it will be overwritten as soon as I “import” the data from the external API again.

Right now I have added a child page containing the extra fields that I need. Then the child page does not get overwritten even if the parent is. It works but It’s not the nicest thing I’ve ever seen.

(The extra fields does not need to be queryble. I don’t need to use like $page->find() or $page->filterBy())

The structure looks like this

my-pages
    page1 (containing fields)
        extra-data (containing more fields)
    page2
        extra-data
    page3
        extra-data

Does anyone have a better solution? or is this a good one? Am I clear enough?

Why? If the page already exists, use the $page->update() function and only update the fields you want to be updated.

Yes, that’s it! So simple! With update I don’t need to replace the whole text file every time. I just update a part of it.