From 32cb783aa8675d275cb9136eeadffa8294d40b89 Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Fri, 1 May 2026 21:28:35 +0200 Subject: created global template and refactored blog templates --- blog/templates/acknowledgement.html.j2 | 4 ++-- blog/templates/blog_base.html.j2 | 25 ++++++++----------------- blog/templates/blogpost.html.j2 | 4 ++-- blog/templates/blogpost_sub.html.j2 | 4 ++-- blog/templates/tag.html.j2 | 4 ++-- blog/templates/tags.html.j2 | 4 ++-- config.py | 1 + global/templates/base.html.j2 | 18 ++++++++++++++++++ 8 files changed, 37 insertions(+), 27 deletions(-) create mode 100644 global/templates/base.html.j2 diff --git a/blog/templates/acknowledgement.html.j2 b/blog/templates/acknowledgement.html.j2 index e12ea6f..87bd188 100644 --- a/blog/templates/acknowledgement.html.j2 +++ b/blog/templates/acknowledgement.html.j2 @@ -1,6 +1,6 @@ {% extends "blog_base.html.j2" %} -{% block page_title %}Acknowledgement {{ super() }}{% endblock %} -{% block page_title_short %}Acknowledgement{% endblock %} +{% block page_title %}Acknowledgement - {{ super() }}{% endblock %} +{% block og_page_title %}Acknowledgement{% endblock %} {% block content %}

Acknowledgement

Thank you for everyone, who made this blog possible, like...
diff --git a/blog/templates/blog_base.html.j2 b/blog/templates/blog_base.html.j2 index 6c5845a..b250abf 100644 --- a/blog/templates/blog_base.html.j2 +++ b/blog/templates/blog_base.html.j2 @@ -1,19 +1,12 @@ - - - - - {% block page_title %}{{ blog.blog_name }}{% endblock %} - - - - - +{% extends "base.html.j2" %} +{% block page_title %}{{ blog.blog_name }}{% endblock %} +{% block og_page_title %}{{ blog.blog_name }}{% endblock %} +{% block og_type %}article{% endblock %} +{% block head_extra %}{{ super() }} - - - -

+ {% endblock %} +{% block body %}
-
- - +
{% endblock %} diff --git a/blog/templates/blogpost.html.j2 b/blog/templates/blogpost.html.j2 index 0a09558..801df54 100644 --- a/blog/templates/blogpost.html.j2 +++ b/blog/templates/blogpost.html.j2 @@ -1,6 +1,6 @@ {% extends "blog_base.html.j2" %} -{% block page_title %}{{ post.title() }} {{ super() }}{% endblock %} -{% block page_title_short %}{{ post.title() }}{% endblock %} +{% block page_title %}{{ post.title() }} - {{ super() }}{% endblock %} +{% block og_page_title %}{{ post.title() }}{% endblock %} {% block content %}

{{ post.title() }}

{{ post.get_prompt("ls tags/") }} diff --git a/blog/templates/blogpost_sub.html.j2 b/blog/templates/blogpost_sub.html.j2 index bc1c2b8..a2c6960 100644 --- a/blog/templates/blogpost_sub.html.j2 +++ b/blog/templates/blogpost_sub.html.j2 @@ -1,6 +1,6 @@ {% extends "blog_base.html.j2" %} -{% block page_title %}{{ post.title() }} {{ super() }}{% endblock %} -{% block page_title_short %}{{ post.title() }}{% endblock %} +{% block page_title %}{{ post.title() }} - {{ super() }}{% endblock %} +{% block og_page_title %}{{ post.title() }}{% endblock %} {% block content %}

{{ post.get_cat_prompt(subpage_name) }}

diff --git a/blog/templates/tag.html.j2 b/blog/templates/tag.html.j2 index 951f233..8334c26 100644 --- a/blog/templates/tag.html.j2 +++ b/blog/templates/tag.html.j2 @@ -1,6 +1,6 @@ {% extends "blog_base.html.j2" %} -{% block page_title %}tags/{{ tag }} {{ super() }}{% endblock %} -{% block page_title_short %}tags/{{ tag }}{% endblock %} +{% block page_title %}tags/{{ tag }} - {{ super() }}{% endblock %} +{% block og_page_title %}tags/{{ tag }}{% endblock %} {% block content %}

tags/{{ tag }}/

{{ config.get_tag_prompt(tag, "find other_posts/ -type f -exec head {} +") }}

diff --git a/blog/templates/tags.html.j2 b/blog/templates/tags.html.j2 index ea4774a..620aaf7 100644 --- a/blog/templates/tags.html.j2 +++ b/blog/templates/tags.html.j2 @@ -1,6 +1,6 @@ {% extends "blog_base.html.j2" %} -{% block page_title %}tags/ {{ super() }}{% endblock %} -{% block page_title_short %}tags/{% endblock %} +{% block page_title %}tags/ - {{ super() }}{% endblock %} +{% block og_page_title %}tags/{% endblock %} {% block content %}

tags/

{{ config.get_tag_prompt("", "ls .") }}

diff --git a/config.py b/config.py index d5ed156..11c16ca 100644 --- a/config.py +++ b/config.py @@ -19,6 +19,7 @@ class Config: BLOG_ROOT_URL = "https://blog.wazul.moe" BLOG_ASSETS_SOURCE_DIR = os.path.join(__DIR, "blog/assets") TEMPLATES_SOURCE_DIR = [ + os.path.join(__DIR, "global/templates"), os.path.join(__DIR, "main/templates"), os.path.join(__DIR, "blog/templates"), os.path.join(__DIR, "comic/templates"), diff --git a/global/templates/base.html.j2 b/global/templates/base.html.j2 new file mode 100644 index 0000000..61826d9 --- /dev/null +++ b/global/templates/base.html.j2 @@ -0,0 +1,18 @@ + + + + + {% block page_title %}{% endblock %} + + + + + {% block head_extra %}{% endblock %} + + +{% block body %}{% endblock %} + + + -- cgit v1.3