App-Chronicle
view release on metacpan or search on metacpan
lib/Chronicle/Plugin/StaticPages.pm view on Meta::CPAN
=head1 NAME
Chronicle::Plugin::StaticPages - Generate non-blog pages.
=head1 DESCRIPTION
If your blog-post contains a "C<page: 1>" header then it will
treat the post as a non-blog static page.
You can manually specify the output path, via a header such as
C<output: about/index.html>.
This contains all the methods to handle the storing and generating of
non-blog pages.
* on_db_create: creates a table within the blog database to store the pages.
* on_insert: inserts new and updated pages.
* on_generate: generates the page.
=cut
=head1 METHODS
Now follows documentation on the available methods.
=cut
package Chronicle::Plugin::StaticPages;
use strict;
use warnings;
use File::Path;
=head1 doc
=head2 on_db_create
Create a table for the static-pages.
=cut
sub on_db_create
{
my ( $self, %args ) = (@_);
#
# Create the "pages" table
#
my $dbh = $args{ 'dbh' };
$dbh->do(
"CREATE TABLE pages (id INTEGER PRIMARY KEY, filename, title, content, template) "
);
}
=head2 on_insert
Don't generate a blog/tag/archive entry if we have a "C<page: 1>" header,
instead insert the post into the static-page table.
=cut
sub on_insert
{
my ( $self, %args ) = (@_);
#
# The post data, DB-handle and config.
#
my $data = $args{ 'data' };
my $dbh = $args{ 'dbh' };
my $config = $args{ 'config' };
#
# Is this a page?
( run in 1.836 second using v1.01-cache-2.11-cpan-39bf76dae61 )