package App::SCS::Plugin::Core::PagePlugin::PageData;

use Moo;

with 'App::SCS::Role::PagePlugin';

sub filter_content_zoom {
  my ($self, $zoom) = @_;
  my $page = $self->page;
  $zoom->select('.page.title')->replace_content($page->title)
       ->select('.page.subtitle')->${\sub {
           $page->subtitle
             ? $_[0]->replace_content($page->subtitle)
             : $_[0]->replace('')
         }}
       ->select('.page.published_at')->replace_content($page->published_at)
       ->select('meta[name=description]')
         ->set_attribute(content => $page->description)
       ->select('meta[name=keywords]')
         ->set_attribute(content => $page->keywords)
       ->select('meta[name=created]')
         ->set_attribute(content => $page->created);
}

1;
