Newcomen

Description A static content generator.
Newcomen > Perl Modules > Newcomen::Plugin::Blog::Index::Lists::Date
Source

Index


NAME ^

Newcomen::Plugin::Blog::Index::Lists::Date - Helps to creates date archive pages.

DESCRIPTION ^

This plugin requires the Newcomen::Plugin::Blog::Index::Lists plugin to be enabled.

This plugin will create the required lists in the meta data of all Newcomen::Source instances with the crawler ID 'Blog::Crawler', so Newcomen::Plugin::Blog::Index::Lists can be used to create the yearly/monthly/daily index pages. See the OPTIONS for an example.

Sources

All Newcomen::Source instances with the crawler ID 'Blog::Crawler' will be processed. Their meta data must contain the values for time/published/year, time/published/Month and time/published/Day, as set by the Newcomen::Plugin::Blog::Source::Time plugin. If any of these is not set or invalid (just a really basic check), the required list will not be created. For details on the lists see the META DATA section.

Collections

There will be meta data added to the collections created by Newcomen::Plugin::Blog::Index::Lists for the date archive pages. See META DATA.

OPTIONS ^

Note: It is recommended to read the META DATA section and the documentation of the Newcomen::Plugin::Blog::Index::Lists plugin first.

There are no default options set for this plugin. See below for a user configuration example.

Example

{
   'blog'                         => {
      'index'                     => {
         'lists'                  => {
            'archive'             => {
               'hierarchical'     => 1,
               'exclude_children' => 0,
               'source_list'      => 'time/lists/day',
               'index'            => {
                  'title'         => 'Archive: <ymd>, Page <page> of <pages>',
                  'url'           => 'archive/<year>/<month>/<day>/index.html',
               },
               'pages'            => {
                  'title'         => 'Archive: <ymd>, Page <page> of <pages>',
                  'url'           => 'archive/<year>/<month>/<day>/page-<page>/index.html',
               },
            },
         },
      },
   },
}

This example configuration will create daily, monthly and yearly listings. The source list will be set to 'time/lists/day', and since the exclude_children option is disabled and and the hierarchical option is set to true, the monthly and yearly index pages will be created from this list, too.

For URL and title options all the placeholders provided by Newcomen::Plugin::Blog::Index::Lists are available, and additionally all the collection meta data created by this plugin may be used as a placeholder, see below.

META DATA ^

Sources

{
   'time'        => {
      'lists'    => {
         'day'   => [ "$year/$month/$day" ],
         'month' => [ "$year/$month"      ],
         'year'  => [ "$year"             ]
      },
   },
}

These are the lists required by the Newcomen::Plugin::Blog::Index::Lists plugin to create the index pages. The month and day values will include a leading zero if the value is less than ten.

The time/lists/day list may be used to generate daily, monthly and yearly archive pages, as shown in the example above. If different settings for the different page types are required, and these can not be expressed in the configuration using the provided placeholders, or if only monthly and/or only yearly archive pages should be created, the other lists may be used as appropriate.

Collections

{
   'year'           => $year,
   'month'          => $month,
   'day'            => $day,
   'ymd'            => $ymd,
   'archive_type'   => $archive_type,
   'archive_source' => $archive_source,
}

year, month and day will be set to the year, month and day of the collection, respectively, including leading zeroes if required. Note that only daily archive collections will include all three values. Monthly archive collections won't include the day, and yearly archive collections will only include the year.

ymd will be set to the values of year, month and day, joined by slashes. Empty parts will not be included. For example, for the monthly index of August 2013, the value would be '2013/08'.

The value of archive_type and archive_source will be one of 'day', 'month' or 'year'.

For archive_source, it will be set to the configured source list, i.e. it will be set to 'day' if the source list of the index page is set to time/lists/day, it will be set to 'month' for the source list time/lists/month and 'year' for the list time/lists/year, no matter what the actual type of the index page is.

archive_type on the other hand will always be set to the actual type of the index page, i.e. it will be set to 'day' for daily listings, 'month' for monthly listings and 'year' for the yearly index pages.

archive_type and archive_source may contain different values for a single collection depending on the exclude_children and hierarchical options. See Newcomen::Plugin::Blog::Index::Lists for details.

SEE ALSO ^

Newcomen::Plugin::Blog::Index::Lists, Newcomen::Plugin::Blog::Source::Time, Newcomen::Source

VERSION ^

This is version 2014052501.

AUTHOR ^

Stefan Goebel - newcomen {at} subtype {dot} de

COPYRIGHT AND LICENSE ^

Copyright 2013-2014 Stefan Goebel.

This file is part of Newcomen.

Newcomen is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the license, or (at your option) any later version.

Newcomen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Newcomen. If not, see <http://www.gnu.org/licenses/>.