Statocles::Document - Base class for all Statocles documents
version 0.057
A Statocles::Document is the base unit of content in Statocles. Applications take documents to build pages.
Documents are usually written as files, with the content in Markdown, and the other attributes as frontmatter, a block of YAML at the top of the file.
An example file with frontmatter looks like:
--- title: My Blog Post author: preaction links: stylesheet: - href: /theme/css/extra.css --- In my younger and more vulnerable years, my father gave me some
The path to this document. This is not settable from the frontmatter.
--- title: My First Post ---
The title of this document. Used in the template and the main page title.
--- author: preaction <doug@example.com> ---
The author of this document. Optional.
The raw content of this document, in markdown. This is everything below the ending --- of the frontmatter.
---
--- tags: recipe, beef, cheese tags: - recipe - beef - cheese ---
The tags for this document. Tags are used to categorize documents.
Tags may be specified as an array or as a comma-separated string of tags.
--- links: stylesheet: - href: /theme/css/extra.css alternate: - href: http://example.com/blog/alternate title: A contributed blog ---
Related links for this document. Links are used to build relationships to other web addresses. Link categories are named based on their relationship. Some possible categories are:
Additional stylesheets for the content of this document.
Additional scripts for the content of this document.
A link to the same document in another format or posted to another web site
Each category contains an arrayref of hashrefs of link objects. See the Statocles::Link documentation for a full list of supported attributes. The most common attributes are:
The URL for the link.
The text of the link. Not needed for stylesheet or script links.
--- date: 2015-03-27 date: 2015-03-27 12:04:00 ---
The date/time this document is for. For pages, this is the last modified date. For blog posts, this is the post's date.
Should be in YYYY-MM-DD or YYYY-MM-DD HH:MM:SS format.
YYYY-MM-DD
YYYY-MM-DD HH:MM:SS
--- template: /blog/recipe.html ---
The path to a template override for this document. If set, the document page will use this instead of the template provided by the application.
The template path should not have the final extention (by default .ep). Different template parsers will have different extentions.
.ep
--- layout: /site/layout-dark.html ---
The path to a layout template override for this document. If set, the document page will use this instead of the layout provided by the application.
--- data: - Eggs - Milk - Cheese --- % for my $item ( @{ $self->data } ) { <%= $item %> % }
Any kind of extra data to attach to this document, either array (like above), hash, string, or number, or combinations of all of these. This is available immediately in the document content, and later in the page template.
Every document's content is parsed as a template. The data attribute can be used in the template to allow for some structured data that would be cumbersome to have to mark up time and again.
data
The content guide describes how to edit content in Statocles sites, which are represented by Document objects.
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2015 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Statocles, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Statocles
CPAN shell
perl -MCPAN -e shell install Statocles
For more information on module installation, please visit the detailed CPAN module installation guide.