diff --git a/files/templates/comments.html b/files/templates/comments.html
index 0122e86dfe..e9a22d41a2 100644
--- a/files/templates/comments.html
+++ b/files/templates/comments.html
@@ -139,7 +139,7 @@
{% for b in c.author.badges %}
- {% if c.author.url %}
+ {% if b.url %}
![]({{b.path}})
{% else %}
![]({{b.path}})
diff --git a/files/templates/submission.html b/files/templates/submission.html
index 90163ffac3..4a20ffc7b6 100644
--- a/files/templates/submission.html
+++ b/files/templates/submission.html
@@ -272,7 +272,7 @@
{% for b in p.author.badges %}
- {% if p.author.url %}
+ {% if b.url %}
![]({{b.path}})
{% else %}
![]({{b.path}})
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html
index c0a68948d1..1d2ecdb883 100644
--- a/files/templates/submission_listing.html
+++ b/files/templates/submission_listing.html
@@ -49,7 +49,7 @@
{% for b in p.author.badges %}
- {% if p.author.url %}
+ {% if b.url %}
![]({{b.path}})
{% else %}