class => 'App::SCS::Plugin::Core::PagePlugin::Include',
config => sub { includes => $self->includes },
},
- PageData => 'App::SCS::Plugin::Core::PagePlugin::PageData',
+ PageData => {
+ class => 'App::SCS::Plugin::Core::PagePlugin::PageData',
+ config => sub { static_dir => $self->app->share_dir->catdir('static') }
+ }
}
sub default_page_plugins {
with 'App::SCS::Role::PagePlugin';
+has static_dir => (is => 'ro', required => 1);
+
sub filter_content_zoom {
my ($self, $zoom) = @_;
+
my $page = $self->page;
+ my $static_dir = $self->static_dir;
+
$zoom->select('.page.title')->replace_content($page->title)
->select('.page.subtitle')->${\sub {
$page->subtitle
->select('meta[name=keywords]')
->set_attribute(content => $page->keywords)
->select('meta[name=created]')
- ->set_attribute(content => $page->created);
+ ->set_attribute(content => $page->created)
+ ->select('link[data-cur-page-css]')->${\sub {
+ if (-f $static_dir . "/page-css/" . $page->path . ".css") {
+ $_[0]->set_attribute(href => "/static/page-css/" . $page->path . ".css");
+ } else {
+ $_[0]->replace('');
+ }
+ }}
}
1;