The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Chronicle::Plugin::Snippets::Tags - Generate tags list.

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

To use this plugin add the following to your theme:

   <!-- tmpl_if name='recent_tags' -->
   <h3>Recent Tags</h3>
   <ul>
   <!-- tmpl_loop name='recent_tags' -->
       <li><a href="/tags/<!-- tmpl_var name='tag' -->"><!-- tmpl_var name='tag' --></a></li>
   <!-- /tmpl_loop -->
   </ul>
   <!-- /tmpl_if name='recent_tags' -->

METHODS

Now follows documentation on the available methods.

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 recent_tags variable containing the recently used tag-names.

The number of tags included in that list will default to 10, but can be changed via the recent-tag-count setting in the configuration file.

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