Chronicle::Plugin::Snippets::RecentPosts - Generate recent posts.
This module will be invoked automatically when your site is built via the on_generate hook which Chronicle provides.
on_generate
It is responsible for creating the a data-structure to show recent posts. The number of posts defaults to ten, but can be changed if you're using a configuration file, via:
recent-post-count = 20
To use this in your theme add the following:
<!-- tmpl_if name='recent_posts' --> <h3>Recent Posts</h3> <ul> <!-- tmpl_loop name='recent_posts' --> <li><b><!-- tmpl_var name='date' --></b> <ul> <li><a href="<!-- tmpl_var name='top' --><!-- tmpl_var name='link' -->"><!-- tmpl_var name='title' --></a></li> </ul></li> <!-- /tmpl_loop --> </ul> <!-- /tmpl_if name='recent_posts' -->
Now follows documentation on the available methods.
The on_initiate method is automatically invoked just before any on_generate methods which might be present.
on_initiate
This method updates the global variables, which are made available to all loaded templates, to define a recent_posts variable containing references to the most recent posts.
recent_posts
The number of tags included in that list will default to 10, but can be changed via the recent-post-count setting in the configuration file.
recent-post-count
This plugin must be called "early".
This means we're called prior to any of the page-generation plugins, such that any page-templates which make use of the data-structure we've created are called after that structure is setup.
This method is present such that Module::Pluggable::Ordered can order our plugins.
This module is free software; you can redistribute it and/or modify it under the terms of either:
a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or
b) the Perl "Artistic License".
Steve Kemp <steve@steve.org.uk>
To install App::Chronicle, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Chronicle
CPAN shell
perl -MCPAN -e shell install App::Chronicle
For more information on module installation, please visit the detailed CPAN module installation guide.