From a5ee54abcbabb483da2488726b1f946446a0dad7 Mon Sep 17 00:00:00 2001
From: yahiko <yahiko012000@gmail.com>
Date: Sun, 15 Dec 2024 14:38:50 +0100
Subject: [PATCH] Remaking index.html form scratch due

---
 .gitignore                            |   8 ++
 simple-erreur503/templates/index.html | 109 ++++++++++++++------------
 2 files changed, 65 insertions(+), 52 deletions(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9c3f03a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+### Python ###
+# Byte-compiled / optimized / DLL files
+__pycache__
+py/__pycache__
+*.py[cod]
+*$py.class
+
+simple-erreur503-old/
\ No newline at end of file
diff --git a/simple-erreur503/templates/index.html b/simple-erreur503/templates/index.html
index b712bb1..ca3eb7a 100644
--- a/simple-erreur503/templates/index.html
+++ b/simple-erreur503/templates/index.html
@@ -1,63 +1,68 @@
 {% extends "base.html" %}
 {% block content %}
+    <!-- Site presentation from pelicanconf -->
     {% if SITE_PRESENTATION %}
         <div class="presentation">{{ SITE_PRESENTATION }}</div>
     {% endif %}
 
+    <!-- Starting the articles listing stuff thing -->
     {% for article in articles_page.object_list %}
-        <!-- Premier article -->
+
+        <!-- First article, display only the last article with summary -->
         {% if loop.first and not articles_page.has_previous() %}
-        {% block content_title %}
-            <h1 class="no-before">Le dernier article</h1>
-        {% endblock %}
-        <article class="article-page first-article">
-            <header>
-            <h1>
-                <a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h1>
-            {% import 'translations.html' as translations with context %}
-            {{ translations.translations_for(article) }}
-            <p><b>Publié le :</b> <time datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}, </time>
-            {% if article.category %}
-            dans la catégorie <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>
-            <p class="tag">
-                <b>Étiquettes :</b>
-                {% for tag in article.tags %}
-                    <a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>
-                {% endfor %}
-            </p>
-        {% endif %}
-            </header>
-            <content>
-                {{ article.summary }}
-            </content>
-        </article>
-        {% block content_last %}
-            <h1 class="no-before">Les 5 derniers articles </h1>
-        {% endblock %}
-        {% else %}
-        {% if loop.first %}
-            <!-- Les articles en liste -->
-            <ol class="index" start="{{ articles_paginator.per_page -1 }}">
-                <li>
-        {% endif %}
-                    <article>
-                        <header><h1 class="art-title"><a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h1>
-                            <p class="art-desc">Publié le : <time datetime="{{ article.date.isoformat() }}"> {{ article.locale_date }} </time> dans la catégorie <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>.</p>
-                        </header>
-                    </article>
-                </li>
-        {% if loop.last %}
-            {% if loop.length > 1 or articles_page.has_other_pages() %}
-                </ol>
-                <!--- Pagination désactivée, on teste des trucs -->
-                <!--{% if articles_page.has_other_pages() %}
-                    {% include 'pagination.html' %}
-                {% endif %}-->
-                <div class="after-index">
-                    <h2>Pour le reste, farfouillez dans les <a href="{{ SITEURL }}/archives.html">archives</a> ou les <a href="{{ SITEURL }}/categories.html">catégories</a>.</h2>
-                </div>
+            {% block content_title %}
+                <h1 class="no-before">Le dernier article</h1>
+            {% endblock %}
+            <article class="article-page first-article">
+                <header>
+                    <h1>
+                        <a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h1>
+                        <p><b>Publié le :</b> <time datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}, </time>
+                        {% if article.category %}
+                            dans la catégorie <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>
+                        {% endif %}
+                        <p class="tag">
+                            <b>Étiquettes :</b>
+                            {% for tag in article.tags %}
+                                    <a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>
+                            {% endfor %}
+                        </p>
+                </header>
+                <content>
+                    {{ article.summary }}
+                </content>
+            </article>
+        
+            <!-- List of next articles display n number of articles -->
+            <!-- Uses DEFAULT_PAGINATION + 1, if you want 5 articles, set DEFAULT_PAGINATION on 6 : first aticle above then 5 articles in the list. -->
+            {% block content_last %}
+                <h1 class="no-before">Les 5 derniers articles </h1>
+            {% endblock %}
+            {% else %}
+            {% if loop.first %}
+                <ol class="index" start="{{ articles_paginator.per_page -1 }}"> <!-- The minus 1 prevent for displaying the article displayed below -->
+                    <li>
+            {% endif %}
+                        <article>
+                            <header><h1 class="art-title"><a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h1>
+                                <p class="art-desc">Publié le : <time datetime="{{ article.date.isoformat() }}"> {{ article.locale_date }} </time> dans la catégorie <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>.</p>
+                            </header>
+                        </article>
+                    </li>
+            <!-- After the list -->
+            {% 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">
+                        <h2>Pour le reste, farfouillez dans les <a href="{{ SITEURL }}/archives.html">archives</a> ou les <a href="{{ SITEURL }}/categories.html">catégories</a>.</h2>
+                    </div>
+                {% endif %}    
             {% endif %}
         {% endif %}
-    {% endif %}
     {% endfor %}
-{% endblock content %}
+{% endblock %}
-- 
GitLab