Add basic blogging support
[sommitrealweird.git] / sommitrealweird / blog / templates / blog / blog_index.html
diff --git a/sommitrealweird/blog/templates/blog/blog_index.html b/sommitrealweird/blog/templates/blog/blog_index.html
new file mode 100644 (file)
index 0000000..8e94748
--- /dev/null
@@ -0,0 +1,46 @@
+{% extends "base.html" %}
+{% load markup %}
+
+{% block content %}
+    {% if entries %}
+        {% for entry in entries %}
+            <h1>{{ entry.title|escape }}</h1>
+            {{ entry.content|restructuredtext }}
+            <p>Posted: {{ entry.publish_date|date:"Y-m-d H:i" }} in 
+                {% for section in entry.sections.all %}
+                    {% if forloop.first %}
+                        <a href="{{ section.get_absolute_url }}">{{ section.title }}</a>{% if not forloop.last %}, {% endif %}
+                    {% else %}
+                        {% if forloop.last %}
+                            and <a href="{{ section.get_absolute_url }}">{{ section.title }}</a>
+                        {% else %}
+                            <a href="{{ section.get_abolute_url }}">{{ section.title }}</a>
+                        {% endif %}
+                    {% endif %}
+                {% endfor %}
+                <a href="{{ entry.get_absolute_url }}">permalink</a></p>
+        {% endfor %}
+        {% if paginated %}
+            <p class="paginator">Pages: 
+            {% if has_prev %}
+                <a href="?page={{ prev }}">Previous</a> |
+            {% endif %}
+            {% for paginator_page in pages %}
+                {% if forloop.first %}
+                {% else %}
+                    |
+                {% endif %}
+                {% ifequal paginator_page page %}
+                    {{ page }}
+                {% else %}
+                    <a href="?page={{ paginator_page }}">{{ paginator_page }}</a>
+                {% endifequal %}
+            {% endfor %}
+            {% if has_next %}
+                | <a href="?page={{ next }}">Next</a>
+            {% endif %}
+        {% endif %}
+    {% else %}
+        <p>We have no blog entries - that sucks!</p>
+    {% endif %}
+{% endblock %}