From: Errietta Kostala Date: Mon, 11 Aug 2014 10:27:43 +0000 (+0100) Subject: Custom HTML elements for blog authors X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3eae042fd309ae2be2c0e0a691a0b4fba939c710;p=scpubgit%2FApp-SCS.git Custom HTML elements for blog authors --- diff --git a/lib/App/SCS/Plugin/Core/PagePlugin/PageData.pm b/lib/App/SCS/Plugin/Core/PagePlugin/PageData.pm index 42910de..142f474 100644 --- a/lib/App/SCS/Plugin/Core/PagePlugin/PageData.pm +++ b/lib/App/SCS/Plugin/Core/PagePlugin/PageData.pm @@ -63,6 +63,20 @@ sub filter_content_zoom { $_[0]->replace(HTML::Zoom->from_html($replace)); }} + ->select('div[data-custom-blog-elements]')->${\sub { + #blog/author(/post) + + return $_[0]->replace('') if $page->path !~ qr#^/blog/([^/]+)/+#; + + my $author = $1; + my $author_templ = $static_dir . "/author-html/$author.html"; + + if (-f $author_templ) { + $_[0]->replace(HTML::Zoom->from_file($author_templ)); + } else { + $_[0]->replace(''); + } + }} } 1;