Statocles::Page - Base class for rendering objects
version 0.064
A Statocles::Page takes one or more documents and renders them into one or more HTML pages using a main template and a layout template.
The site this page is part of.
The application this page came from, so we can give it to the templates.
The absolute URL path to save this page to.
The title of the page. Any unsafe characters in the title (<, >, ", and &) will be escaped by the template, so no HTML allowed.
<
>
"
&
The MIME type of this page. By default, will use the path's file extension to detect a likely type.
The date of this page. Used for last updated date and blog post dates.
A hash of additional template variables for this page.
A hash of arrays of links to pages related to this page. Possible keys:
feed - Feed pages related to this page alternate - Alternate versions of this page posted to other sites
Each item in the array is a link object. The most common attributes are:
text - The text of the link href - The page for the link type - The MIME type of the link, optional
A hash of images related to this page. Each value should be an image object. These are used by themes to show images next to articles, thumbnails, and/or shortcut icons.
The markdown object to render document Markdown. Defaults to the markdown attribute from the Site object.
Any object with a "markdown" method will work.
The main template for this page. The result will be wrapped in the layout template.
The layout template for this page, which will wrap the content generated by the template.
How frequently a search engine should check this page for changes. This is used in the sitemap.xml to give hints to search engines.
Should be one of:
always hourly daily weekly monthly yearly never
Defaults to weekly.
weekly
NOTE: This is only a hint to search engines, not a command. Pages marked hourly may be checked less often, and pages marked never may still be checked once in a while. never is mainly used for archived pages or permanent links.
hourly
never
How high should this page rank in search results compared to similar pages on this site? This is used in the sitemap.xml to rank individual, full pages more highly than aggregate, list pages.
Value should be between 0.0 and 1.0. The default is 0.5.
0.0
1.0
0.5
This is only used to decide which pages are more important for the search engine to crawl, and which pages within your site should be given to users. It does not improve your rankings compared to other sites. See the sitemap protocol for details.
my %vars = $page->vars;
Get extra template variables for this page
my $html = $page->render( %vars );
Render the page, using the template and wrapping with the layout. Give any extra %vars to the template, layout, and page content method (if applicable).
%vars
content
The result of this method is cached.
my @links = $page->links( $key ); my $link = $page->links( $key ); $page->links( $key => $add_link );
Get or append to the links set for the given key. See the links attribute for some commonly-used keys.
If only one argument is given, returns a list of link objects. In scalar context, returns the first link in the list.
If two arguments are given, append the new link to the given key. $add_link may be a URL string, a hash reference of link attributes, or a Statocles::Link object. When adding links, nothing is returned.
$add_link
my $image = $page->images( $key );
Get the images for the given key. See the images attribute for some commonly-used keys. Returns an image object.
my $name = $page->basename;
Get the base file name of this page. Everything after the last /.
/
my $dir = $page->dirname;
Get the full directory to this page. Anything that isn't part of "basename".
There will not be a trailing slash unless it is the root directory.
A page that renders a single document.
A page that renders a list of other pages.
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2016 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.