]> git.ipfire.org Git - ipfire.org.git/commitdiff
blog: Show useful message when no posts with a certain tag exist
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Sep 2018 15:28:26 +0000 (16:28 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Sep 2018 15:28:26 +0000 (16:28 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/blog/tag.html
src/web/blog.py

index c95611132e45e39f8d9c90761776712920a1a4f7..749c6aa533df0b899abe81c699b2ffa1a45282bb 100644 (file)
@@ -5,7 +5,13 @@
 {% block main %}
        <div class="card">
                <div class="card-body">
-                       {% module BlogPosts(posts) %}
+                       {% if posts %}
+                               {% module BlogPosts(posts) %}
+                       {% else %}
+                               <p class="text-center text-muted my-5">
+                                       {{ _("There are no posts tagged with '%s'") % tag }}
+                               </p>
+                       {% end %}
                </div>
        </div>
 {% end block %}
index ca76a5a2b605fdecc03ab1ec469c3c772f4c7483..8c24f3e5787f6ff85820936361441b86437e2b56 100644 (file)
@@ -85,7 +85,7 @@ class TagHandler(base.BaseHandler):
                if not posts:
                        raise tornado.web.HTTPError(404, "There are no posts with tag: %s" % tag)
 
-               self.render("blog/tag.html", posts=posts, tag=tag)
+               self.render("blog/tag.html", posts=list(posts), tag=tag)
 
 
 class YearHandler(base.BaseHandler):