Преглед на файлове

fix #27: about page header/footer themable

George S. Baugh преди 5 години
родител
ревизия
9bcbaad22b

+ 15 - 1
lib/Trog/Routes/HTML.pm

@@ -486,9 +486,21 @@ sub posts ($query, $input, $render_cb) {
     return _rss($query,$posts) if $fmt eq 'rss';
 
     my $processor = Text::Xslate->new(
-        path   => _dir_for_resource('posts.tx'),
+        path   => $template_dir,
     );
 
+    # Themed header/footer for about page -- TODO maybe make this generic so we can have MESSAGE FROM JIMBO WALES everywhere
+    my ($header,$footer);
+    if ($query->{route} eq '/about' || $query->{route} eq '/humans.txt') {
+        my $t_processor;
+        $t_processor = Text::Xslate->new(
+            path =>  "www/$theme_dir/templates",
+        ) if $theme_dir;
+
+        $header = _pick_processor("templates/about_header.tx"  ,$processor,$t_processor)->render('about_header.tx');
+        $footer = _pick_processor("templates/about_header.tx"  ,$processor,$t_processor)->render('about_footer.tx');
+    }
+
     my $styles = _build_themed_styles('posts.css');
 
     my $content = $processor->render('posts.tx', {
@@ -501,6 +513,8 @@ sub posts ($query, $input, $render_cb) {
         rss      => !$query->{id},
         tiled    => scalar(grep { $_ eq $query->{route} } qw{/files /audio /video /image /series}),
         category => $themed ? Theme::path_to_tile($query->{route}) : $query->{route},
+        about_header => $header,
+        about_footer => $footer,
     });
     return Trog::Routes::HTML::index($query, $input, $render_cb, $content, $styles);
 }

+ 15 - 0
www/templates/about_footer.tx

@@ -0,0 +1,15 @@
+<br /><br />
+<h3>FAQ</h3>
+<p>
+* Why does tCMS not support comments?
+</p>
+<p>
+Being the publisher of content from random yahoos is best handled by social media giants, mostly for legal reasons.
+Don't overcomplicate your life with that stuff; instead get an RSS based repost bot like feed2tweet to syndicate for the peanut gallery.
+</p>
+<p>
+Besides, you want to maximize your reach anyways, right?
+You may as well get on the social platforms.
+Comments also don't appear to have an effect on the authority your site has in search engines.
+So you save huge time and headaches, and build yet another audience funnel by not fighting the social media giants.
+</p>

+ 3 - 0
www/templates/about_header.tx

@@ -0,0 +1,3 @@
+<p>
+tCMS is built thanks to viewers like you.  Here's who's to blame:
+</p>

+ 7 - 0
www/templates/posts.tx

@@ -4,6 +4,9 @@
 <: $category :>:
 : }
 </span>
+: if ( $about_header ) {
+    <: $about_header | mark_raw :>
+: }
 <hr class="divider" />
 : for $posts -> $post {
     :if ( $tiled ) {
@@ -61,3 +64,7 @@
 : if ( $rss ) {
 : include "paginator.tx";
 : }
+: if ( $about_footer ) {
+    <: $about_footer | mark_raw :>
+: }
+

+ 14 - 0
www/themes/teodesian.net/templates/about_footer.tx

@@ -0,0 +1,14 @@
+<br /><br />
+<h3>FAQ</h3>
+<p>
+Q. So, what's with the LibraryThing widget you have?
+</p>
+<p>
+As an Amazon Associate I earn from qualifying purchases. Translation: Full SELLOUT mode activated. Welcome to the "<a href="https://therationalmale.com/2020/07/22/the-rise-of-the-hustle-economy/">hustle economy</a>".
+</p>
+<hr />
+<h3>Site Trivia</h3>
+<ul>
+    <li>Site Version: 'Hamletarodance'</li>
+    <li>This site is HTML5/CSS/JS with Perl written in VIM using <a href="https://tcms.troglodyne.net">tCMS</a></li>
+</ul>

+ 3 - 0
www/themes/teodesian.net/templates/about_header.tx

@@ -0,0 +1,3 @@
+<p>
+TEODESIAN.NET - who's to blame:
+</p>