Newcomen

Description A static content generator.
Newcomen > Perl Modules > Newcomen::Plugin::Blog::Source::Slug
Source

Index


NAME ^

Newcomen::Plugin::Blog::Source::Slug - Sets the source item's slug.

DESCRIPTION ^

This plugin will set the "slug" for all blog sources (all Newcomen::Source instances with the creator ID 'Blog::Crawler'), which may later be used in the output file names of single article pages.

The initial value will be set to the source's meta data slug value, if it exists. If this doesn't exist, the plugin looks for the meta data value of path/source/basename (this will be set by the Newcomen::Role::Crawler::Filesystem role used by Newcomen::Plugin::Blog::Crawler). If this is set, the basename of the source file will be used without the file name extension. If the initial value could not be set (i.e. both slug and path/source/basename are not set or empty), this plugin will die().

The initial value will then be cleaned up, basically the same procedure as is used in the plugin Newcomen::Plugin::Rewrite::Clean, with the exception that all slashes will be replaced by dashes initially (so you can not use the slug to create directories).

If, after the clean up, the slug is empty, this plugin will die(), else the slug will be stored in the source item's meta data as slug (overriding the initial value if it was set).

META DATA ^

Sources

{
   'slug' => $slug,
}

The final value of the slug (as describes in the DESCRIPTION) will be stored in the meta data.

HOOKS ^

This plugin implements the hook_process_source() hook (default priority).

SEE ALSO ^

Newcomen::Plugin::Blog::Crawler, Newcomen::Plugin::Rewrite::Clean, Newcomen::Role::Crawler::Filesystem, Newcomen::Source

VERSION ^

This is version 2014052501.

AUTHOR ^

Stefan Goebel - newcomen {at} subtype {dot} de

COPYRIGHT AND LICENSE ^

Copyright 2013-2014 Stefan Goebel.

This file is part of Newcomen.

Newcomen is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the license, or (at your option) any later version.

Newcomen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Newcomen. If not, see <http://www.gnu.org/licenses/>.