initial import of App::SCS code
[scpubgit/App-SCS.git] / lib / App / SCS / Plugin / Core / PagePlugin / PageData.pm
diff --git a/lib/App/SCS/Plugin/Core/PagePlugin/PageData.pm b/lib/App/SCS/Plugin/Core/PagePlugin/PageData.pm
new file mode 100644 (file)
index 0000000..daf529f
--- /dev/null
@@ -0,0 +1,25 @@
+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;