From 294a6683b5b96aa5afcd6ae518f0b17eb523db3d Mon Sep 17 00:00:00 2001
From: david-swift
Date: Fri, 11 Apr 2025 17:54:23 +0200
Subject: [PATCH] Improve structure in HTML templates
---
templates/article.html | 122 +-----------------------
templates/article_list.html | 20 +---
templates/documentation_page.html | 98 +------------------
templates/partials/article_content.html | 114 ++++++++++++++++++++++
templates/partials/banner.html | 5 +
templates/partials/paginator.html | 19 ++++
templates/subproject.html | 105 +-------------------
templates/subproject_list.html | 20 +---
8 files changed, 145 insertions(+), 358 deletions(-)
create mode 100644 templates/partials/article_content.html
create mode 100644 templates/partials/banner.html
create mode 100644 templates/partials/paginator.html
diff --git a/templates/article.html b/templates/article.html
index 07c62e9..19806c1 100644
--- a/templates/article.html
+++ b/templates/article.html
@@ -12,126 +12,8 @@
{%- endif -%}
- {%- if page.extra.banner -%}
-
-
-
- {%- endif -%}
-
-
- {%- if page.date -%}
-
-
-
- {%- if page.updated -%}
- {{ config.extra.separator | default(value="•") }}
-
- {%- endif -%}
-
-
- {%- endif -%}
-
-
{{ page.title }}
-
- {%- if page.authors or config.extra.show_reading_time -%}
-
-
- {%- if page.authors -%}
- {% include "partials/authors.html" -%}
- {%- if config.extra.show_reading_time -%}
- {{ config.extra.separator | default(value="•") }}
- {%- endif -%}
- {%- endif -%}
-
- {%- if config.extra.show_reading_time -%}
- {{ macros_translate::translate(key="minutes_read", number=page.reading_time, default="$NUMBER minute read", language_strings=language_strings) }}
- {%- if page.taxonomies -%}
- {{ config.extra.separator | default(value="•") }}
- {%- endif -%}
- {%- endif -%}
-
-
- {%- endif -%}
-
- {%- if page.taxonomies -%}
- {%- for name, taxon in page.taxonomies %}
-
- {%- endfor -%}
- {%- endif %}
-
-
-
-
- {%- include "partials/statements.html" -%}
-
- {%- if page.extra.toc_inline -%}
- {%- include "partials/toc.html" -%}
- {%- elif config.extra.toc_inline -%}
- {%- include "partials/toc.html" -%}
- {%- endif -%}
-
- {{ page.content | safe }}
+ {% include "partials/banner.html" %}
+ {% include "partials/article_content.html" %}
{%- if page.extra.comments.id -%}
diff --git a/templates/article_list.html b/templates/article_list.html
index a623199..559b707 100644
--- a/templates/article_list.html
+++ b/templates/article_list.html
@@ -43,24 +43,6 @@
{% include "partials/articles.html" %}
+{% include "partials/paginator.html" %}
-{%- if paginator.pages -%}
-
-
-
-
{{ page.title }}
-
- {%- if page.authors or config.extra.show_reading_time -%}
-
-
- {%- if page.authors -%}
- {% include "partials/authors.html" -%}
- {%- if config.extra.show_reading_time -%}
- {{ config.extra.separator | default(value="•") }}
- {%- endif -%}
- {%- endif -%}
-
- {%- if config.extra.show_reading_time -%}
- {{ macros_translate::translate(key="minutes_read", number=page.reading_time, default="$NUMBER minute read", language_strings=language_strings) }}
- {%- if page.taxonomies -%}
- {{ config.extra.separator | default(value="•") }}
- {%- endif -%}
- {%- endif -%}
-
-
- {%- endif -%}
-
- {%- if page.taxonomies -%}
- {%- for name, taxon in page.taxonomies %}
-
- {%- endfor -%}
- {%- endif %}
-
-
-
-
- {%- include "partials/statements.html" -%}
-
- {%- if page.extra.toc_inline -%}
- {%- include "partials/toc.html" -%}
- {%- elif config.extra.toc_inline -%}
- {%- include "partials/toc.html" -%}
- {%- endif -%}
-
- {{ page.content | safe }}
+ {% include "partials/article_content.html" %}
diff --git a/templates/partials/article_content.html b/templates/partials/article_content.html
new file mode 100644
index 0000000..9bccb27
--- /dev/null
+++ b/templates/partials/article_content.html
@@ -0,0 +1,114 @@
+
+ {%- if page.date -%}
+
+
+
+ {%- if page.updated -%}
+ {{ config.extra.separator | default(value="•") }}
+
+ {%- endif -%}
+
+
+ {%- endif -%}
+
+
{{ page.title }}
+
+ {%- if page.authors or config.extra.show_reading_time -%}
+
+
+ {%- if page.authors -%}
+ {% include "partials/authors.html" -%}
+ {%- if config.extra.show_reading_time -%}
+ {{ config.extra.separator | default(value="•") }}
+ {%- endif -%}
+ {%- endif -%}
+
+ {%- if config.extra.show_reading_time -%}
+ {{ macros_translate::translate(key="minutes_read", number=page.reading_time, default="$NUMBER minute read", language_strings=language_strings) }}
+ {%- if page.taxonomies -%}
+ {{ config.extra.separator | default(value="•") }}
+ {%- endif -%}
+ {%- endif -%}
+
+
+ {%- endif -%}
+
+ {%- if page.taxonomies -%}
+ {%- for name, taxon in page.taxonomies %}
+
+ {%- endfor -%}
+ {%- endif %}
+
+
+
+
+{%- include "partials/statements.html" -%}
+
+{%- if page.extra.toc_inline -%}
+ {%- include "partials/toc.html" -%}
+{%- elif config.extra.toc_inline -%}
+ {%- include "partials/toc.html" -%}
+{%- endif -%}
+
+{{ page.content | safe }}
diff --git a/templates/partials/banner.html b/templates/partials/banner.html
new file mode 100644
index 0000000..f69d726
--- /dev/null
+++ b/templates/partials/banner.html
@@ -0,0 +1,5 @@
+{%- if page.extra.banner -%}
+
+
+
+{%- endif -%}
diff --git a/templates/partials/paginator.html b/templates/partials/paginator.html
new file mode 100644
index 0000000..a55f792
--- /dev/null
+++ b/templates/partials/paginator.html
@@ -0,0 +1,19 @@
+{%- if paginator.pages -%}
+
+{%- endif -%}
diff --git a/templates/subproject.html b/templates/subproject.html
index e932137..cc0f3a4 100644
--- a/templates/subproject.html
+++ b/templates/subproject.html
@@ -12,109 +12,8 @@
{%- set section = get_section(path=page.ancestors | last) -%}
- {%- if page.extra.banner -%}
-
-
-
- {%- endif -%}
-
-
-
-
{{ page.title }}
-
- {%- if page.authors or config.extra.show_reading_time -%}
-
-
- {%- if page.authors -%}
- {% include "partials/authors.html" -%}
- {%- if config.extra.show_reading_time -%}
- {{ config.extra.separator | default(value="•") }}
- {%- endif -%}
- {%- endif -%}
-
- {%- if config.extra.show_reading_time -%}
- {{ macros_translate::translate(key="minutes_read", number=page.reading_time, default="$NUMBER minute read", language_strings=language_strings) }}
- {%- if page.taxonomies -%}
- {{ config.extra.separator | default(value="•") }}
- {%- endif -%}
- {%- endif -%}
-
-
- {%- endif -%}
-
- {%- if page.taxonomies -%}
- {%- for name, taxon in page.taxonomies %}
-
- {%- endfor -%}
- {%- endif %}
-
-
-
-
- {%- include "partials/statements.html" -%}
-
- {%- if page.extra.toc_inline -%}
- {%- include "partials/toc.html" -%}
- {%- elif config.extra.toc_inline -%}
- {%- include "partials/toc.html" -%}
- {%- endif -%}
-
- {{ page.content | safe }}
+ {% include "partials/banner.html" %}
+ {% include "partials/article_content.html" %}
{%- if page.extra.comments.id -%}
diff --git a/templates/subproject_list.html b/templates/subproject_list.html
index cbe2155..67920e3 100644
--- a/templates/subproject_list.html
+++ b/templates/subproject_list.html
@@ -43,24 +43,6 @@
{% include "partials/subprojects.html" %}
+{% include "partials/paginator.html" %}
-{%- if paginator.pages -%}
-
-{%- endif -%}
{% endblock content %}