aboutsummaryrefslogtreecommitdiff
path: root/templates/blog
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-06-11 19:58:32 -0400
committerBobby <[email protected]>2023-06-11 19:58:32 -0400
commitb0d1c9827c53d3d33facf08fc2043f43801ae6fa (patch)
tree7f65453db57b603b8e233bf76883956a6821e156 /templates/blog
parent114460370c2613ea103b6eb709b3ea076d045bc9 (diff)
downloadthatcomputerscientist-b0d1c9827c53d3d33facf08fc2043f43801ae6fa.tar.xz
thatcomputerscientist-b0d1c9827c53d3d33facf08fc2043f43801ae6fa.zip
Tags are now available on the blog
Diffstat (limited to 'templates/blog')
-rw-r--r--templates/blog/partials/post_list.html12
-rw-r--r--templates/blog/partials/sidebar.html8
-rw-r--r--templates/blog/post.html6
-rw-r--r--templates/blog/tagged.html12
-rw-r--r--templates/blog/tags.html20
5 files changed, 52 insertions, 6 deletions
diff --git a/templates/blog/partials/post_list.html b/templates/blog/partials/post_list.html
index cdab9c41..d72bd723 100644
--- a/templates/blog/partials/post_list.html
+++ b/templates/blog/partials/post_list.html
@@ -30,8 +30,16 @@
{{ post.excerpt | safe }}
</div>
<div class="post-actions" style="clear: both;">
- <a href="{% url 'blog:post' post.slug %}">Continue Reading</a> | <a href="{% url 'blog:post' post.slug %}#comments">{{ post.num_comments }}
- Comment{% if not post.num_comments == 1 %}s{% endif %}</a>
+ <span style="float: left; margin: 8px 0 0 0;">
+ <a href="{% url 'blog:post' post.slug %}">Continue Reading</a> | <a href="{% url 'blog:post' post.slug %}#comments">{{ post.num_comments }}
+ Comment{% if not post.num_comments == 1 %}s{% endif %}</a>
+ </span>
+ {% comment %} tags {% endcomment %}
+ <span style="float: right;">
+ {% for tag in post.tags.all %}
+ <a class="tag" href="{% url 'blog:tag_posts' tag.slug %}">{{ tag.name }}</a>
+ {% endfor %}
+ </span>
</div>
</div>
{% endfor %} \ No newline at end of file
diff --git a/templates/blog/partials/sidebar.html b/templates/blog/partials/sidebar.html
index 68018db5..0944cc89 100644
--- a/templates/blog/partials/sidebar.html
+++ b/templates/blog/partials/sidebar.html
@@ -38,7 +38,7 @@
{% endif %}
{% if user.is_authenticated %}
-<div id="user-area">
+<div id="user-area" style="position: relative">
<h2>Hello, {{ user.username }}!</h2>
<ul>
<li>
@@ -118,16 +118,16 @@
</a>
</span>
</li>
- {% comment %} <li>
+ <li>
<span>
<img src="{% static 'images/site/icons/issues.gif' %}" alt="Tags" border="0">
</span>
<span>
- <a href="#">
+ <a href="{% url 'blog:tags' %}">
Tags
</a>
</span>
- </li> {% endcomment %}
+ </li>
<li>
<span>
<img src="{% static 'images/site/icons/translate.png' %}" alt="Translate" border="0">
diff --git a/templates/blog/post.html b/templates/blog/post.html
index 1c27eb4f..8769c253 100644
--- a/templates/blog/post.html
+++ b/templates/blog/post.html
@@ -39,7 +39,13 @@
<span style="margin-left: 4px;">{% localtime on %}{{ post.date | date:"M d, Y" }}{% endlocaltime %}</span>
<span style="margin-left: 4px;"><b>|</b></span>
<span style="margin-left: 4px;">{{ post.views }} view{% if not post.views == 1%}s{% endif %}</span>
+
</div>
+ <p>
+ {% for tag in post.tags.all %}
+ <a class="tag" href="{% url 'blog:tag_posts' tag.slug %}">{{ tag.name }}</a>
+ {% endfor %}
+ </p>
<div id="article-body">
{{ post.first_paragraph | safe }}
diff --git a/templates/blog/tagged.html b/templates/blog/tagged.html
new file mode 100644
index 00000000..192ef2ee
--- /dev/null
+++ b/templates/blog/tagged.html
@@ -0,0 +1,12 @@
+{% extends 'blog/partials/base.html' %} {% block content %}
+{% load static %}
+<h2 style="margin-top:15px;">Posts Tagged With "{{ tag.name }}"</h2>
+{% if posts %}
+<div style="margin-top: -10px;">
+ {% include 'blog/partials/post_list.html' %}
+</div>
+{% else %}
+<p>There are no posts tagged with "{{ tag.name }}".</p>
+{% endif %}
+{% endblock %}
+
diff --git a/templates/blog/tags.html b/templates/blog/tags.html
new file mode 100644
index 00000000..44dcac61
--- /dev/null
+++ b/templates/blog/tags.html
@@ -0,0 +1,20 @@
+{% extends 'blog/partials/base.html' %} {% block content %}
+<h2 style="margin-top:15px;">All Tags</h2>
+{% load static %}
+{% if tags %}
+{% comment %} Varying font sizes based on tag.count {% endcomment %}
+{% comment %} <ol> {% endcomment %}
+<center>
+{% for tag in tags %}
+ <span style="margin-bottom:8px;">
+ <a class="tag" style="font-size:{{ tag.pxs }}px;" href="{% url 'blog:tag_posts' tag.slug %}">{{ tag.name }} ({{ tag.count }} post{{ tag.count|pluralize }})</a>
+ </span>
+{% endfor %}
+</center>
+{% comment %} </ol> {% endcomment %}
+{% else %}
+<p>No Tags found.</p>
+{% endif %}
+
+{% endblock %}
+