- Sometimes you need to reference pages to each other, usually by the page ID
- When you update a page URI, the ID can change and references to this page from other page/fields can be lost.
- This plugin automatically updates selected fields when a referenced ID change.
Use one of the alternatives below.
1. Using kirby-webpack
Simply use the built-in Kirby Package Manager by running:
$ npm run kirby:add
$ [?] Git URL: https://github.com/brocessing/kirby-updateid
$ [?] Module name: updateid
$ [?] Category: plugins
If you are using the Kirby CLI you can install this plugin by running the following commands in your shell:
$ cd path/to/kirby
$ kirby plugin:install brocessing/kirby-updateid
Make sure that the plugin folder structure looks like this:
site/plugins/updateid/
If you know your way around Git, you can download this plugin as a submodule:
$ cd path/to/kirby
$ git submodule add https://github.com/brocessing/kirby-updateid site/plugins/updateid
Use c::set('plugin.updateid', array $config)
to specify which fields can be updated.
c::set('plugin.updateid', array(
// On the homepage, page ids from the field featured_works will be auto-updated
array(
'pages' => 'home',
'fields' => 'featured_works'
),
// You can add other pages
// And use arrays to specify multiple pages & multiple fields to update
array(
'pages' => ['about', 'contact'],
'fields' => ['emails', 'authors']
)
));
c::set('plugin.updateid', array(
// Auto-update client ID on each project page
array(
'pages' => function () { return site()->find('work')->children(); },
'fields' => 'client'
)
));
- Kirby 2.3+
This field is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.
It is discouraged to use this field in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.