From ae3cc502f7354d1e7bf1d9c8353807d60b120396 Mon Sep 17 00:00:00 2001
From: yahiko <yahiko012000@gmail.com>
Date: Sun, 2 Feb 2025 15:37:04 +0100
Subject: [PATCH] Pagination display modified, drafts display moved to a page,
 added categories emoji to catgoeries.html

---
 simple-erreur503/static/css/categories.css |  7 +++++
 simple-erreur503/templates/article.html    |  2 +-
 simple-erreur503/templates/categories.html |  2 +-
 simple-erreur503/templates/drafts.html     |  8 ++++++
 simple-erreur503/templates/index.html      | 32 +++++++++-------------
 simple-erreur503/templates/pagination.html | 32 ++++++++++------------
 6 files changed, 45 insertions(+), 38 deletions(-)
 create mode 100644 simple-erreur503/templates/drafts.html

diff --git a/simple-erreur503/static/css/categories.css b/simple-erreur503/static/css/categories.css
index af3ca92..89af13d 100644
--- a/simple-erreur503/static/css/categories.css
+++ b/simple-erreur503/static/css/categories.css
@@ -22,6 +22,13 @@
     margin-left: -5px;
 }
 
+/* livres */
+.cat-livres::before {
+	content: "📚";
+	letter-spacing: 10px;
+    margin-left: -5px;
+}
+
 /* musique */
 .cat-musique::before {
 	content: "🎵";
diff --git a/simple-erreur503/templates/article.html b/simple-erreur503/templates/article.html
index 7953cfb..5d3f1f9 100644
--- a/simple-erreur503/templates/article.html
+++ b/simple-erreur503/templates/article.html
@@ -30,7 +30,7 @@
       {% import 'translations.html' as translations with context %}
       {{ translations.translations_for(article) }}
       <p><b>Publié le :</b> <time datetime="{{ article.date.isoformat() }}">
-        {{ article.locale_date }}, 
+        {{ article.locale_date }}
       </time>
       {% if article.category %}
        dans la catégorie <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a></p>
diff --git a/simple-erreur503/templates/categories.html b/simple-erreur503/templates/categories.html
index 1f84ec0..bc9aa74 100644
--- a/simple-erreur503/templates/categories.html
+++ b/simple-erreur503/templates/categories.html
@@ -6,7 +6,7 @@
     <h1>Catégories</h1>
     <ul class="categories">
         {% for category, articles in categories|sort %}
-            <li><h2><a href="{{ SITEURL }}/{{ category.url }}">{{ category }}</a> ({{ articles|count }})</h2></li>
+            <li><h2><span class="cat-{{ category.slug }}"><a href="{{ SITEURL }}/{{ category.url }}">{{ category }}</a> ({{ articles|count }})</h2></span></li>
         {% endfor %}
     </ul>
 
diff --git a/simple-erreur503/templates/drafts.html b/simple-erreur503/templates/drafts.html
new file mode 100644
index 0000000..0e46e89
--- /dev/null
+++ b/simple-erreur503/templates/drafts.html
@@ -0,0 +1,8 @@
+<h1>Brouillons</h1>
+<div class="drafts">
+    <ul>
+        {% for draft in drafts %}  
+                <li><a href="{{ SITEURL }}/{{ draft.url }}">{{ draft.title }}</a></li>
+        {% endfor %}
+    </ul>
+</div>
\ No newline at end of file
diff --git a/simple-erreur503/templates/index.html b/simple-erreur503/templates/index.html
index 3b9680f..454d1e6 100644
--- a/simple-erreur503/templates/index.html
+++ b/simple-erreur503/templates/index.html
@@ -6,18 +6,10 @@
     {% endif %}
 
     {% if DISPLAY_DRAFT %}
-        <h1>Brouillons</h1>
-        <div class="drafts">
-            <ul>
-                {% for draft in drafts %}  
-                        <li><a href="{{ SITEURL }}/{{ draft.url }}">{{ draft.title }}</a></li>
-                {% endfor %}
-            </ul>
-        </div>
+        {% include 'drafts.html' %}
     {% endif %}
 
-    <!-- Starting the articles listing stuff thing, except 'journal' category -->
-    {% for article in articles_page.object_list  %}
+    {% for article in articles_page.object_list %}
         <!-- First article, display only the last article with summary -->
         {% if loop.first and not articles_page.has_previous() %}
             {% block content_title %}
@@ -50,7 +42,7 @@
                 <h1 class="no-before">Les {{ DEFAULT_PAGINATION -1 }} articles précédents</h1>
             {% endblock %}
             {% else %}
-            {% if loop.first %}
+            {% if loop.first and not article.category %}
                 <ol class="index" start="{{ articles_paginator.per_page -1 }}"> <!-- The minus 1 prevent for displaying the article displayed below -->
                     <li>
             {% endif %}
@@ -67,16 +59,18 @@
             {% if loop.last %}
                 {% if loop.length > 1 or articles_page.has_other_pages() %}
                  </ol>
-                 <!--- Pagination is possible, just commented it -->
-                 <!-- {# #} is the Jinja way to comment -->
-                    {# {% if articles_page.has_other_pages() %}
-                        {% include 'pagination.html' %}
-                    {% endif %} #}
-                    <div class="after-index">
-                        <p>Pour le reste, farfouillez dans les <a href="{{ SITEURL }}/archives.html">archives</a> ou les <a href="{{ SITEURL }}/categories.html">catégories</a>.</p>
-                    </div>
+                 <!--- Pagination is possible, PAGINATION variable as to be True in pelicanconf -->
+                    {% if PAGINATION %}
+                        {% if articles_page.has_other_pages() %}
+                            {% include 'pagination.html' %}
+                        {% endif %}
+                    {% endif %}
                 {% endif %}    
             {% endif %}
         {% endif %}
     {% endfor %}
+
+    <div class="after-index">
+        <p>Pour le reste, farfouillez dans les <a href="{{ SITEURL }}/archives.html">archives</a> ou les <a href="{{ SITEURL }}/categories.html">catégories</a>.</p>
+    </div>
 {% endblock %}
diff --git a/simple-erreur503/templates/pagination.html b/simple-erreur503/templates/pagination.html
index 7815fb6..475bd02 100644
--- a/simple-erreur503/templates/pagination.html
+++ b/simple-erreur503/templates/pagination.html
@@ -1,17 +1,15 @@
-{% if DEFAULT_PAGINATION %}
-  {% set first_page = articles_paginator.page(1) %}
-  {% set last_page = articles_paginator.page(articles_paginator.num_pages) %}
-  <nav class="pagination">
-    <ul>
-      {% if articles_page.has_previous() %}
-        <li><a href="{{ SITEURL }}/{{ first_page.url }}">⏮</a></li>
-        <li><a href="{{ SITEURL }}/{{ articles_previous_page.url }}">⏴</a></li>
-      {% endif %}
-      <li>Page {{ articles_page.number }} / {{ articles_paginator.num_pages }}</li>
-      {% if articles_page.has_next() %}
-        <li><a href="{{ SITEURL }}/{{ articles_next_page.url }}">⏵</a></li>
-        <li><a href="{{ SITEURL }}/{{ last_page.url }}">⏭</a></li>
-      {% endif %}
-    </ul>
-  </nav>
-{% endif %}
+{% set first_page = articles_paginator.page(1) %}
+{% set last_page = articles_paginator.page(articles_paginator.num_pages) %}
+<nav class="pagination">
+  <ul>
+    {% if articles_page.has_previous() %}
+      <li><a href="{{ SITEURL }}/{{ first_page.url }}">⏮</a></li>
+      <li><a href="{{ SITEURL }}/{{ articles_previous_page.url }}">⏴</a></li>
+    {% endif %}
+    <li>Page {{ articles_page.number }} / {{ articles_paginator.num_pages }}</li>
+    {% if articles_page.has_next() %}
+      <li><a href="{{ SITEURL }}/{{ articles_next_page.url }}">⏵</a></li>
+      <li><a href="{{ SITEURL }}/{{ last_page.url }}">⏭</a></li>
+    {% endif %}
+  </ul>
+</nav
\ No newline at end of file
-- 
GitLab