Only show tags if they exist.

master
Nick Sergeant 2012-04-16 18:38:56 -04:00
parent b1b7779309
commit 8d9bdff1e2
2 changed files with 28 additions and 24 deletions

View File

@ -47,20 +47,22 @@
</li>
{% endif %}
</ul>
<section class="tags">
<h2>{{ snipt.tags.all|length }} tag{{ snipt.tags.all|pluralize }}</h2>
<ul>
{% for tag in snipt.sorted_tags %}
<li {% if forloop.counter > 3 and not detail %}class="hidden"{% endif %}>
{% if public %}
<a href="/public/tag/{{ tag.slug }}/">{{ tag }}</a>
{% else %}
<a href="/{{ snipt.user.username }}/tag/{{ tag.slug }}/">{{ tag }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</section>
{% if snipt.tags.all %}
<section class="tags">
<h2>{{ snipt.tags.all|length }} tag{{ snipt.tags.all|pluralize }}</h2>
<ul>
{% for tag in snipt.sorted_tags %}
<li {% if forloop.counter > 3 and not detail %}class="hidden"{% endif %}>
{% if public %}
<a href="/public/tag/{{ tag.slug }}/">{{ tag }}</a>
{% else %}
<a href="/{{ snipt.user.username }}/tag/{{ tag.slug }}/">{{ tag }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</section>
{% endif %}
</aside>
</div>
<footer>

View File

@ -1,10 +1,12 @@
<section class="tags">
<h1>{{ user.username }}'s tags</h1>
<ul>
{% for t in tags %}
<li>
<a {% if tag.name == t.name %}class="active"{% endif %} href="/{{ user.username }}/tag/{{ t.slug }}/">{{ t.name }} ({{ t.count }})</a>
</li>
{% endfor %}
</ul>
</section>
{% if tags %}
<section class="tags">
<h1>{{ user.username }}'s tags</h1>
<ul>
{% for t in tags %}
<li>
<a {% if tag.name == t.name %}class="active"{% endif %} href="/{{ user.username }}/tag/{{ t.slug }}/">{{ t.name }} ({{ t.count }})</a>
</li>
{% endfor %}
</ul>
</section>
{% endif %}