1 package App::SCS::Plugin::Core::PagePlugin::PageData;
5 with 'App::SCS::Role::PagePlugin';
7 has static_dir => (is => 'ro', required => 1);
9 sub filter_content_zoom {
10 my ($self, $zoom) = @_;
12 my $page = $self->page;
13 my $static_dir = $self->static_dir;
15 $zoom->select('.page.title')->replace_content($page->title)
16 ->select('.page.subtitle')->${\sub {
18 ? $_[0]->replace_content($page->subtitle)
21 ->select('.page.published_at')->${\sub {
23 ? $_[0]->replace_content($page->published_at)
26 ->select('meta[name=description]')
27 ->set_attribute(content => $page->description)
28 ->select('meta[name=keywords]')
29 ->set_attribute(content => $page->keywords)
30 ->select('meta[name=created]')
31 ->set_attribute(content => $page->created)
32 ->select('link[data-cur-page-css]')->${\sub {
35 my @parts = split /\//, $page->path;
37 foreach my $part (@parts) {
42 if (-f $static_dir . "/page-css/$path.css") {
43 $replace .= "<link href='/static/page-css/$path.css' rel='stylesheet' type='text/css' />";
47 $_[0]->replace(HTML::Zoom->from_html($replace));
49 ->select('script[data-cur-page-js]')->${\sub {
52 my @parts = split /\//, $page->path;
54 foreach my $part (@parts) {
59 if (-f $static_dir . "/page-js/$path.js") {
60 $replace .= "<script src='/static/page-js/$path.js' type='text/javascript'></script>";
64 $_[0]->replace(HTML::Zoom->from_html($replace));