/kirby-drafts-widget

Drafts Widget for the dashboard of Kirby. Displays unpublished pages in a nice list

Primary LanguagePHPMIT LicenseMIT

Kirby Drafts Widget

Kirby Drafts Widget logo

Version License Kirby Version

Panel dashboard widget displaying all unpublished pages for Kirby.

Kirby Drafts Widget screenshot

Installation

1. Kirby CLI

If you are using the Kirby CLI you can install this plugin by running the following command in your shell from the root folder of your Kirby installation:

kirby plugin:install Thiousi/kirby-drafts-widget

2. Manual

Download this archive, extract it and rename it to drafts-widget. Copy the folder to your site/plugins folder.

3. Git Submodule

If you know your way around git, you can download this as a submodule:

$ git submodule add https://github.com/Thiousi/kirby-drafts-widget site/plugins/drafts-widget

Usage

You don't have anything to do once the widget is installed. The widget has two states:

1. No drafts to display

Kirby Drafts Widget no drafts

2. Drafts to display

Kirby Drafts Widget unpublished

Options

The following options can be set in your /site/config/config.php file:

/* Drafts widget */
c::set('plugin.drafts.widget.exclude', array('error'));
c::set('plugin.drafts.widget.title', 'Your drafts');
c::set('plugin.drafts.widget.nodrafts', 'No drafts... Start writing today!');
c::set('plugin.drafts.widget.hide.empty', false);

plugin.drafts.widget.exclude

This option is an array of pages that will be excluded from the drafts widget. Add pages after 'error', separated by a comma, and between single quotes

plugin.drafts.widget.title

This option is a string, which is displayed instead of 'Your drafts' as the title of the widget.

plugin.drafts.widget.nodrafts

This option is a string, which is displayed instead of the list of drafts when there are no drafts.

plugin.drafts.widget.hide.empty

This option is a boolean. Set it to true to hide the widget if there are no drafts. Of course, the value of plugin.drafts.widget.nodrafts is meaningless then.

To-do

  • Internationalize widget? Already ok for draft names, only message is not internationalized
  • Get list of excluded pages from configuration instead of widget code
  • Update readme
  • Make it CLI and submodule compatible

Credits

This plugin was created as part of writing up a tutorial on macotuts: https://macotuts.com/tuto/medium/creating-first-widget

License

MIT

Changelog

1.0.0

  • Initialial release

1.1.0

  • Made CLI compatible
  • Made Submodule compatible
  • Enhanced Readme
  • Updated screenshots
  • Fixed compressed headline and spacing issues

1.2.0

  • Text now set in configuration
  • List of excluded pages now set in configuration
  • Readme enhanced with options