NAME
Chronicle::Plugin::Snippets::Archives - Generate archives.
DESCRIPTION
This module will be invoked automatically when your site is built via the on_generate
hook which Chronicle provides.
It is responsible for creating the a data-structure to show archived posts which is a nested loop of:
year1/
month1 - count
month2 - count
..
year2/
month1 - count
month2 - count
..
Whether you choose to use this in your templates is up to you.
Like most of these global-data the output will look reasonable, and be fast, for a small number of posts, but quickly become slow and crowded with a large history.
on_initiate
The on_initiate
method is automatically invoked just before any on_generate
methods which might be present.
This method updates the global variables, which are made available to all loaded templates, to define a archived_posts
variable containing a nested loop of all the posts made ever.
The outer-loop contains the years that have posts, and for each distinct year there is a nested loop containing references to the posts in each month of that year.
_years
Find distinct years which have had posts in them.
_months_in_year
Find distinct months which have had posts in them, from the given year.
_order
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.
LICENSE
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".
AUTHOR
Steve Kemp <steve@steve.org.uk>