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.
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.
You need Kirby 2.2.1 or newer to use this version of the plugin.
For older versions of Kirby 2, please check out the legacy branch!
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 order The parameter filter
needs some more configuration:
visible
– returns only visible pages if set to TRUE
and only invisible ones if set to FALSE
template
– filters by (one or more) used templates intendedTemplate
filters by (one or more) intended templatesfilterBy
, filterMethod
and filterValue
make use of the filterBy method for pages (Example)...
fields:
mysubpagelist:
label: My Subpagelist
type: subpagelist
flip: true
filter:
visible: true
template: mytemplate
...
The following parameter will be inherited from the pages
settings.
limit
– adds pagination after x items...
pages:
limit: 32
...
To hide the subpages in the sidebar, simply add this to your blueprint (as described in the Kirby docs):
...
pages:
hide: true
...