daf529f92cadb5441022cbca498d1309eb9f82aa
[scpubgit/App-SCS.git] / lib / App / SCS / Plugin / Core / PagePlugin / PageData.pm
1 package App::SCS::Plugin::Core::PagePlugin::PageData;
2
3 use Moo;
4
5 with 'App::SCS::Role::PagePlugin';
6
7 sub filter_content_zoom {
8   my ($self, $zoom) = @_;
9   my $page = $self->page;
10   $zoom->select('.page.title')->replace_content($page->title)
11        ->select('.page.subtitle')->${\sub {
12            $page->subtitle
13              ? $_[0]->replace_content($page->subtitle)
14              : $_[0]->replace('')
15          }}
16        ->select('.page.published_at')->replace_content($page->published_at)
17        ->select('meta[name=description]')
18          ->set_attribute(content => $page->description)
19        ->select('meta[name=keywords]')
20          ->set_attribute(content => $page->keywords)
21        ->select('meta[name=created]')
22          ->set_attribute(content => $page->created);
23 }
24
25 1;