The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojolicious::Plugin::ContentManagement::Source::Filesystem - content from files

SYNOPSIS

    # Mojolicious
    $self->plugin( content_management => {
        source      => 'filesystem',
        source_conf => { directory => 'content' },
        ...
    });

    # Mojolicious::Lite
    plugin content_management => {
        source      => 'filesystem',
        source_conf => { directory => 'content' },
        ...
    };

DESCRIPTION

Now you can use the filesystem for content management. With the settings above you can have a directory structure like this:

    project_dir/
        content/
            01-foo.html
            01-foo/
                bar.html
            02-baz.html

which will give you three pages,

    /foo.html
    /foo/bar.html
    /baz.html

You can place a number and a dash in front of the files or directories to define the ordering.

CONFIGURATION

With the source_conf hash ref you can pass the directory under which the content files will live. Default: 'content'

METHODS

This class implements the abstract methods of its base class Mojolicious::Plugin::ContentManagement::Source and the following new ones:

build_tree

    my $filesystem = $filesystem->build_tree;

You can call this method to refresh the page tree from the filesystem.

SEE ALSO

Mojolicious::Plugin::ContentManagement, Mojolicious::Plugin::ContentManagement::Source