Custom HTML elements for blog authors
Errietta Kostala [Mon, 11 Aug 2014 10:27:43 +0000 (11:27 +0100)]
lib/App/SCS/Plugin/Core/PagePlugin/PageData.pm

index 42910de..142f474 100644 (file)
@@ -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;