Fork me on GitHub
(source)

NAME

Statocles::App::Blog - A blog application

DESCRIPTION

This is a simple blog application for Statocles.

FEATURES

ATTRIBUTES

store

The store to read for documents.

tag_text

A hash of tag and descriptions to introduce tags. Having a description is optional.

page_size

The number of posts to put in a page (the main page and the tag pages). Defaults to 5.

index_tags

Filter the tags shown in the index page. An array of tags prefixed with either a + or a -. By prefixing the tag with a "-", it will be removed from the index, unless a later tag prefixed with a "+" also matches.

By default, all tags are shown on the index page.

So, given a document with tags "foo", and "bar":

    index_tags => [ ];                  # document will be included
    index_tags => [ '-foo' ];           # document will not be included
    index_tags => [ '-foo', '+bar' ];   # document will be included

METHODS

command

    my $exitval = $app->command( $app_name, @args );

Run a command on this app. The app name is used to build the help, so users get exactly what they need to run.

make_slug

    my $slug = $app->make_slug( $title );

Given a post title, remove special characters to create a slug.

post_pages

    my @pages = $app->post_pages;

Get the individual post Statocles::Page objects.

post_files

    my @pages = $app->post_files;

Get all the post collateral files as Statocles::Page objects. Markdown files will be created as Statocles::Page::Document objects, any other files will be Statocles::Page::File objects.

index

    my @pages = $app->index( @post_pages );

Build the index page (a list page) and all related feed pages out of the given post pages (built from the post_pages method).

tag_pages

    my @pages = $app->tag_pages( @post_pages );

Get pages for the tags in the given blog post documents (build from the post_pages method, including relevant feed pages.

pages

    my @pages = $app->pages;

Get all the pages for this application.

tags

    my @links = $app->tags;

Get a set of link objects suitable for creating a list of tag links. The common attributes are:

    text => 'The tag text'
    href => 'The URL to the tag page'

recent_posts

    my @pages = $app->recent_posts( $count, %filter );

Get the last $count recent posts for this blog. Useful for templates and site index pages.

%filter is an optional set of filters to apply to only show recent posts matching the given criteria. The following filters are available:

tags

(string) Only show posts with the given tag

page_url

    my $url = $app->page_url( $page )

Return the absolute URL to this page object, removing the "/index.html" if necessary.

COMMANDS

post

    post [--date <date>] <title>

Create a new blog post, optionally setting an initial title. The post will be created in a directory according to the current date.

Initial post content can be read from STDIN. This lets you write other programs to generate content for blog posts (for example, to help automate release blog posts).

THEME

blog => index

The index page template. Gets the following template variables:

site

The Statocles::Site object.

pages

An array reference containing all the blog post pages. Each page is a hash reference with the following keys:

content

The post content

title

The post title

author

The post author

blog => post

The main post page template. Gets the following template variables:

site

The Statocles::Site object

content

The post content

title

The post title

author

The post author

SEE ALSO

Statocles::App