NAME

Statocles::Page - Base role for rendering files

DESCRIPTION

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.

ATTRIBUTES

site

The site this page is part of.

app

The application this page came from, so we can give it to the templates.

path

The absolute URL path to save this page to.

type

The MIME type of this page. By default, will use the path's file extension to detect a likely type.

date

The date of this page. Used for last updated date and blog post dates.

data

A hash of additional template variables for this page.

markdown

The markdown object to render document Markdown. Defaults to the markdown attribute from the Site object.

Any object with a "markdown" method will work.

template

The main template for this page. The result will be wrapped in the layout template.

layout

The layout template for this page, which will wrap the content generated by the template.

search_change_frequency

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.

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.

search_priority

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.

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.

dom

A Mojo::DOM object containing the HTML DOM of the rendered content for this page. Any edits made to this object will be reflected in the file written.

Editing this DOM object is the recommended way to edit pages.

METHODS

has_dom

Returns true if the page can render a DOM

vars

    my %vars = $page->vars;

Get extra template variables for this page

render

    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).

The result of this method is cached.

basename

    my $name = $page->basename;

Get the base file name of this page. Everything after the last /.

dirname

    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.

SEE ALSO

Statocles::Page::Document

A page that renders a single document.

Statocles::Page::List

A page that renders a list of other pages.