With this field plugin for Kirby 2 you can display the list of subpages in the main column of the panel. Simply add the new field „subpagelist” to your blueprints.
To use this plugin with Kirby 2.2.1 or newer, please check out the master branch!
With this plugin I basically wanted to level up my Kirby skills (learning by doing). It is inspired by this topic by thguenther. If you have any tipps or suggestions, please contact me.
Add (if necessary) a new fields
folder to your site
directory. Then copy the whole content of this repository in a new folder called subpagelist
. Your directory structure should now look like this:
site/
fields/
subpagelist/
assets/
subpagelist.php
template.php
It is possible to add this plugin as a Git submodule.
$ cd your/project/root
$ git submodule add https://github.com/flokosiol/kirby-subpagelist.git site/fields/subpagelist
For more information, have a look at Working with Git in the Kirby blog.
Now you are ready to use the new field subpagelist
in your blueprints.
...
fields:
mysubpagelist:
label: My Subpagelist
type: subpagelist
...
There are some optional parameter, which change the display of the subpagelist
flip
– returns the subpages in reverse orderlimit
– adds pagination after x items
The parameter filter
needs some more configuration:
visible
– returns only visible pages if set toTRUE
and only invisible ones if set toFALSE
template
– filters by used (and not by intended) template
...
fields:
mysubpagelist:
label: My Subpagelist
type: subpagelist
flip: true
limit: 32
filter:
visible: true
template: mytemplate
...
To hide the subpages in the sidebar, simply add this to your blueprint (as described in the Kirby docs):
...
pages:
hide: true
...