Fork me on GitHub
(source)

NAME

Statocles::App - Base role for Statocles applications

SYNOPSIS

    package MyApp;
    use Statocles::Base 'Class';
    with 'Statocles::App';

    sub pages {
        return Statocles::Page::Content->new(
            path => '/index.html',
            content => 'Hello, World',
        );
    }

DESCRIPTION

A Statocles App creates a set of pages that can then be written to the filesystem (or served directly, if desired).

Pages can be created from documents stored in a store (see Statocles::Page::Document), files stored in a store (see Statocles::Page::File), lists of content (see Statocles::Page::List), or anything at all (see Statocles::Page::Content).

ATTRIBUTES

site

The site this app is part of.

data

A hash of arbitrary data available to theme templates. This is a good place to put extra structured data like social network links or make easy customizations to themes like header image URLs.

url_root

The URL root of this application. All pages from this app will be under this root. Use this to ensure two apps do not try to write the same path.

METHODS

pages

    my @pages = $app->pages;

Get the pages for this app. Must return a list of Statocles::Page objects.

url

    my $app_url = $app->url( $path );

Get a URL to a page in this application. Prepends the app's url_root attribute if necessary. Strips "index.html" if possible.

    my $link = $app->link( %args )

Create a link to a page in this application. %args are attributes to be given to Statocles::Link constructor. The app's url_root attribute is prepended, if necessary.

INCLUDED APPS

These applications are included with the core Statocles distribution.

Statocles::App::Blog
Statocles::App::Plain
Statocles::App::Static
Statocles::App::Perldoc

SEE ALSO

Statocles::Store
Statocle::Page