Skip to content

💪 A Kirby plugin to automatically update references to a page id

License

Notifications You must be signed in to change notification settings

brocessing/kirby-updateid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Kirby UpdateID

Automatically update references to a page id

version kirby_version license



About

  • 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.

Installation

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

2. Kirby CLI

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

3. Clone or download

  1. Clone or download this repository.
  2. Unzip the archive if needed and rename the folder to updateid.

Make sure that the plugin folder structure looks like this:

site/plugins/updateid/

4. Git Submodule

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

Setup & Usage

Use c::set('plugin.updateid', array $config) to specify which fields can be updated.

Basic configuration:
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']
  )
));
You can also use a function to select a collection of pages
c::set('plugin.updateid', array(
  // Auto-update client ID on each project page
  array(
    'pages'  => function () { return site()->find('work')->children(); },
    'fields' => 'client'
  )
));

Requirements


Disclaimer

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.


License

MIT

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.

About

💪 A Kirby plugin to automatically update references to a page id

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages