From e11981069b6ba491d48e912071300917299790be Mon Sep 17 00:00:00 2001 From: Salif Mehmed Date: Tue, 12 Nov 2024 00:08:57 +0200 Subject: [PATCH] Add sitemap and fix things --- justfile | 3 ++- static/i18n.json | 24 ++++++++++++------------ static/js/linkita.js | 6 +----- static/main.css | 4 ++++ templates/index.html | 10 +++++----- templates/pages.html | 2 +- templates/partials/comment.html | 2 +- templates/partials/head.html | 3 --- templates/partials/header.html | 19 ++++++++++--------- templates/partials/page_list.html | 4 ++-- templates/partials/post_navigation.html | 8 +++----- templates/partials/profile.html | 2 +- templates/partials/toc.html | 8 ++++---- templates/section.html | 4 ++-- templates/shortcodes/gallery.html | 12 ++++++------ templates/sitemap.xml | 19 +++++++++++++++++++ templates/taxonomy_single.html | 10 +++++----- 17 files changed, 78 insertions(+), 62 deletions(-) create mode 100644 templates/sitemap.xml diff --git a/justfile b/justfile index 312f606..f3d2759 100755 --- a/justfile +++ b/justfile @@ -19,7 +19,8 @@ switch-to-latest: [group('dev')] serve: - zola serve --interface 0.0.0.0 --base-url $(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p') + {{ zola }} serve --interface 0.0.0.0 --base-url \ + $(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p') [group('dev')] push-linkita: diff --git a/static/i18n.json b/static/i18n.json index fe4f31f..518c2cc 100644 --- a/static/i18n.json +++ b/static/i18n.json @@ -388,20 +388,20 @@ "glb": "Linkita" }, "word_prev_page": { - "en": "← Prev Page", - "uwu": "← pwev page", - "uwu2": "← Pwev Page", - "bg": "← Предишна страница", - "eo": "← Antaŭa paĝo", - "glb": "← sayfa" + "en": "Prev Page", + "uwu": "pwev page", + "uwu2": "Pwev Page", + "bg": "Предишна страница", + "eo": "Antaŭa paĝo", + "glb": "sayfa" }, "word_next_page": { - "en": "Next Page →", - "uwu": "nyext page →", - "uwu2": "Nyext Page →", - "bg": "Следваща страница →", - "eo": "Sekva paĝo →", - "glb": "sayfa →" + "en": "Next Page", + "uwu": "nyext page", + "uwu2": "Nyext Page", + "bg": "Следваща страница", + "eo": "Sekva paĝo", + "glb": "sayfa" }, "word_toc": { "en": "Table of Contents", diff --git a/static/js/linkita.js b/static/js/linkita.js index 7c05d69..ebd1973 100644 --- a/static/js/linkita.js +++ b/static/js/linkita.js @@ -83,16 +83,12 @@ }) } - function main() { - initDarkMode(); - } - window.linkita = { applyDarkMode: applyDarkMode, toggleDarkMode: toggleDarkMode, + initDarkMode: initDarkMode, initTranslationsButton: initTranslationsButton, toggleHeaderMenu: toggleHeaderMenu, initKatex: initKatex, }; - main(); })(); diff --git a/static/main.css b/static/main.css index 912cb41..7b2f378 100644 --- a/static/main.css +++ b/static/main.css @@ -2075,6 +2075,10 @@ article { padding-bottom: 0px; } + .lg\:pt-32 { + padding-top: 8rem; + } + .lg\:text-base { font-size: 1rem; line-height: 1.5rem; diff --git a/templates/index.html b/templates/index.html index ca7caa4..1084841 100644 --- a/templates/index.html +++ b/templates/index.html @@ -11,18 +11,18 @@ {% include "injects/body_start.html" ignore missing %} -
+
{%- if config.build_search_index %} {% include "partials/search.html" %} {%- endif %} {% block main %} - {%- if paginator is undefined or paginator.current_index == 1 %} - {% include "partials/profile.html" %} - {%- endif %} + {%- if paginator is undefined or paginator.current_index == 1 %} + {% include "partials/profile.html" %} + {%- endif %} - {% include "partials/page_list.html" %} + {% include "partials/page_list.html" %} {% endblock main %}
diff --git a/templates/pages.html b/templates/pages.html index 4904574..ab016c2 100644 --- a/templates/pages.html +++ b/templates/pages.html @@ -1,4 +1,4 @@ -{% extends "index.html" %} +{% extends "index.html" %} {% block main %}
diff --git a/templates/partials/comment.html b/templates/partials/comment.html index 9a299f0..4a11f73 100644 --- a/templates/partials/comment.html +++ b/templates/partials/comment.html @@ -17,4 +17,4 @@ crossorigin="anonymous" async > -{% endif %} +{% endif %} diff --git a/templates/partials/head.html b/templates/partials/head.html index 17ec393..dd0df01 100644 --- a/templates/partials/head.html +++ b/templates/partials/head.html @@ -112,9 +112,6 @@ {%- endfor %} {%- endif %} - {%- if page_authors | length > 0 %} - - {%- endif %} {%- if page.extra.open_graph.content_tier %} {%- endif %} diff --git a/templates/partials/header.html b/templates/partials/header.html index 58401ce..338391a 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -22,10 +22,10 @@ {{ config.title }} {%- elif header_button == "home_button" or header_button == "site_title" %} {%- elif header_button == "theme_button" %} + {%- elif header_button == "search_button" and config.build_search_index %} {%- elif header_button == "translations_button" and (page.translations or section.translations) %} {%- endif %} diff --git a/templates/partials/page_list.html b/templates/partials/page_list.html index 11d2f46..f28886c 100644 --- a/templates/partials/page_list.html +++ b/templates/partials/page_list.html @@ -43,13 +43,13 @@

{{ page.title }}

{{ macros::translate(key="word_prev_page", language=lang, trans_data=trans_data) }} + >‹ {{ macros::translate(key="word_prev_page", language=lang, trans_data=trans_data) }} {% endif %} {% if paginator.next %} {{ macros::translate(key="word_next_page", language=lang, trans_data=trans_data) }} + >{{ macros::translate(key="word_next_page", language=lang, trans_data=trans_data) }} › {% endif %} {% endif %} diff --git a/templates/partials/post_navigation.html b/templates/partials/post_navigation.html index 50a9ab4..c641c8f 100644 --- a/templates/partials/post_navigation.html +++ b/templates/partials/post_navigation.html @@ -4,15 +4,13 @@ {{ page.higher.title }} - {% endif %} + >{{ page.higher.title }} + {% endif %} {% if page.lower %} {{ page.lower.title }} + >{{ page.lower.title }} {% endif %} {% endif %} diff --git a/templates/partials/profile.html b/templates/partials/profile.html index 6ef89eb..36422e7 100644 --- a/templates/partials/profile.html +++ b/templates/partials/profile.html @@ -36,7 +36,7 @@ if profile_data.languages[lang].avatar_alt %} alt="{{ profile_data.languages[lang].avatar_alt }}"{% elif profile_data.avatar_alt %} alt="{{ profile_data.avatar_alt }}"{% endif %} /> - {%- endif %} + {%- endif %} {% if profile_name %}
diff --git a/templates/partials/toc.html b/templates/partials/toc.html index 45308f7..7ad9ce0 100644 --- a/templates/partials/toc.html +++ b/templates/partials/toc.html @@ -1,8 +1,8 @@ -{% if page.toc %} -
+{% if page.toc %} +
- - {{ macros::translate(key="word_toc", language=lang, trans_data=trans_data) }} + + {{ macros::translate(key="word_toc", language=lang, trans_data=trans_data) }}
    diff --git a/templates/section.html b/templates/section.html index 90c8e90..60412f8 100644 --- a/templates/section.html +++ b/templates/section.html @@ -1,7 +1,7 @@ -{% extends "index.html" %} +{% extends "index.html" %} {% block main %}

    {{ section.title }}

    -{% include "partials/page_list.html" %} +{% include "partials/page_list.html" %} {% endblock main %} diff --git a/templates/shortcodes/gallery.html b/templates/shortcodes/gallery.html index 45c47b7..5ae337e 100644 --- a/templates/shortcodes/gallery.html +++ b/templates/shortcodes/gallery.html @@ -1,13 +1,13 @@
    - {% for asset in page.assets -%} - {%- if asset is matching("[.](jpg|png)$") %} - {%- set image = resize_image(path=asset, width=240, height=180) %} - {%- set asset_name = asset | split(pat="/") | slice(start=-1) | join(sep="/") %} +{% for asset in page.assets -%} + {%- if asset is matching("[.](jpg|png)$") %} + {%- set image = resize_image(path=asset, width=240, height=180) %} + {%- set asset_name = asset | split(pat="/") | slice(start=-1) | join(sep="/") %} {{ alts[asset_name] }} - {%- endif %} - {%- endfor %} + {%- endif %} +{%- endfor %}
    diff --git a/templates/sitemap.xml b/templates/sitemap.xml new file mode 100644 index 0000000..ff3b283 --- /dev/null +++ b/templates/sitemap.xml @@ -0,0 +1,19 @@ + + +{%- for sitemap_entry in entries %} + + {{ sitemap_entry.permalink | escape_xml | safe }} + {%- if sitemap_entry.extra.sitemap.updated is defined %} + {{ sitemap_entry.extra.sitemap.updated | escape_xml | safe }} + {%- elif sitemap_entry.updated %} + {{ sitemap_entry.updated | escape_xml | safe }} + {%- endif %} + {%- if sitemap_entry.extra.sitemap.changefreq is defined %} + {{ sitemap_entry.extra.sitemap.changefreq | escape_xml | safe }} + {%- endif %} + {%- if sitemap_entry.extra.sitemap.priority is defined %} + {{ sitemap_entry.extra.sitemap.priority | escape_xml | safe }} + {%- endif %} + +{%- endfor %} + diff --git a/templates/taxonomy_single.html b/templates/taxonomy_single.html index 5338822..9c9b9fe 100644 --- a/templates/taxonomy_single.html +++ b/templates/taxonomy_single.html @@ -1,9 +1,9 @@ -{% extends "index.html" %} +{% extends "index.html" %} {% block main %} -{% if taxonomy.name == "authors" %} - {%- if paginator is undefined or paginator.current_index == 1 %} -{% include "partials/profile.html" %} +{%- if taxonomy.name == "authors" %} + {%- if paginator is undefined or paginator.current_index == 1 %} +{% include "partials/profile.html" %} {%- else %}

    {{ macros::get_profile_name(username=term.name) }}

    {%- endif %} @@ -15,5 +15,5 @@

    {{ term.name | title }}

    {{ term.name }}

    {%- endif %} -{% include "partials/page_list.html" %} +{% include "partials/page_list.html" %} {% endblock main %}