flokosiol / kirby-subpagelist

Subpagelist field plugin for Kirby 2
MIT License
46 stars 4 forks source link

Kirby Subpagelist

Version

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.

Please notice

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.

Requirements

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!

Preview

Screenshot

Installation

Copy & Paste

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

Git Submodule

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.

Usage

Now you are ready to use the new field subpagelist in your blueprints.

...
fields:
    mysubpagelist:
        label: My Subpagelist
        type:  subpagelist
...

Optional settings

There are some optional parameter, which change the display of the subpagelist

The parameter filter needs some more configuration:

Example

...
fields:
    mysubpagelist:
        label: My Subpagelist
        type:  subpagelist

        flip:  true
        filter:
            visible: true
            template: mytemplate                        
...

Optional pages settings

The following parameter will be inherited from the pages settings.

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