add pages to demo sidebar!
[scpubgit/SCS.git] / lib / SCSite / Page.pm
CommitLineData
ebd4c292 1package SCSite::Page;
2
3use IO::All;
4use Moo;
5
34597fb2 6has $_ => (is => 'ro') for qw(title description keywords body created path);
ebd4c292 7
34597fb2 8has "_$_" => (is => 'ro', init_arg => $_) for qw(page_set);
ebd4c292 9
10sub children {
fc436d2e 11 my ($self, %args) = @_;
12 if (my $at = delete $args{at_depth}) {
13warn "Here, $at";
14 @args{qw(min_depth max_depth)} = ($at-1, $at);
15 }
ebd4c292 16 my $ps = $self->_page_set;
17 (ref $ps)->new(
34597fb2 18 top_dir => $ps->base_dir,
19 base_dir => io->dir($ps->base_dir)->catdir($self->path),
fc436d2e 20 max_depth => 1,
21 %args,
ebd4c292 22 );
23}
24
251;