NAME

Statocles::Role::PageAttrs - A role implementing common attributes for pages/documents

VERSION

version 0.098

ATTRIBUTES

title

The title of the page. Any unsafe characters in the title (<, >, ", and &) will be escaped by the template, so no HTML allowed.

author

The author of the 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
    stylesheet  - Additional stylesheets for this page
    script      - Additional scripts for this page

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

images

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.

METHODS

links

    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 or more arguments are given, append the new links 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.

images

    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.

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

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.