diff --git a/www/blog/entry.inc.html b/www/blog/entry.inc.html new file mode 100644 index 0000000..f95fe5c --- /dev/null +++ b/www/blog/entry.inc.html @@ -0,0 +1,82 @@ +{# Reusable template for showing a blog post content #} +{% from "google-ads.inc.html" import leaderboard %} + +{% macro blog_entry(post, from=None) %} + + {% if from == "index" %} + + {{ post["subject"] }} +

+ {% endif %} + +

+ {% if post["avatar"] %} + + {% elif post["photo"] %} + + {% else %} + + {% endif %} +
+ + {{ post["profile"]["username"] }} +
+ +
+ Posted by {{ post["profile"]["name"] }} + on {{ post["pretty_time"] }} +
+ + {{ post["body"] | safe }} + +

+

+ Categories: + {% if post["categories"]|length == 0 %} + Uncategorized{# TODO hardcoded name #} + {% else %} + + {% endif %} +

+ + [ + {% if from == "index" %} + {% if post["comments"] %}{# Allowed comments #} + {{ post["comment_count"] }} comment{% if post["comment_count"] != 1 %}s{% endif %} + | + Add comment + | + {% endif %} + + Permalink + {% else %} + Blog + {% endif %} + + {% if session["login"] %} + | + Edit + | + Delete + {% endif %} + ] +

+

+ + {# Show the Google ad after the first post. #} + {% if from == "index" and post["position_index"] == 1 %} + {{ leaderboard() }} + {% endif %} + + {% if from != "index" %} + {{ include_page("comment.partial_index", + thread="blog-"+post["post_id"]|string, + subject=post["subject"], + ) | safe }} + {% endif %} + +{% endmacro %} diff --git a/www/google-ads.inc.html b/www/google-ads.inc.html new file mode 100644 index 0000000..3dc1c8f --- /dev/null +++ b/www/google-ads.inc.html @@ -0,0 +1,33 @@ +{# Google ads for Kirsle.net #} + +{% macro nav_ads() %} +

+ + +
+{% endmacro %} + +{% macro leaderboard() %} +
+ + +
+{% endmacro %} \ No newline at end of file diff --git a/www/layout.html b/www/layout.html index 8d58e68..1ac3a51 100644 --- a/www/layout.html +++ b/www/layout.html @@ -12,6 +12,8 @@ +{% from "google-ads.inc.html" import leaderboard, nav_ads %} +
@@ -30,6 +32,10 @@ {% block content %}{% endblock %} + {% if uri not in ["/", "/blog/index"] and not "/blog/category" in uri %} + {{ leaderboard() }} + {% endif %} + -
- - -
+ {{ nav_ads() }}
Fan Club