From fe6de0eb171786980d417755f65ca5638d02da99 Mon Sep 17 00:00:00 2001 From: daudix Date: Fri, 21 Jun 2024 20:39:43 +0300 Subject: [PATCH] Deprecate the animated_favicon variable APNG seems to be well supported so it's not needed I guess --- config.toml | 6 +- content/_index.md | 4 + content/blog/the-quill-of-duck/index.md | 1 + i18n/ar.toml | 1 + i18n/en.toml | 1 + i18n/ru.toml | 1 + templates/anchor-link.html | 7 -- templates/article.html | 92 +++++++++++-------- templates/article_list.html | 38 ++++---- templates/base.html | 18 ++-- templates/page.html | 4 +- templates/partials/comments.html | 45 ++++----- .../{copy-button.html => copy_button.html} | 3 +- templates/partials/footer.html | 56 +++++------ templates/partials/head.html | 90 +++++++++--------- templates/partials/language_switcher.html | 4 +- templates/partials/nav.html | 34 ++++--- templates/shortcodes/image.html | 10 +- templates/shortcodes/video.html | 2 +- templates/taxonomy_list.html | 6 +- templates/taxonomy_single.html | 40 ++++---- 21 files changed, 228 insertions(+), 235 deletions(-) rename templates/partials/{copy-button.html => copy_button.html} (93%) diff --git a/config.toml b/config.toml index c7600bc..d100d5b 100644 --- a/config.toml +++ b/config.toml @@ -3,7 +3,7 @@ base_url = "https://daudix.codeberg.page/duckquill" description = "Modern, pretty, and clean theme." compile_sass = true -minify_html = true +minify_html = false generate_feed = true feed_filename = "atom.xml" build_search_index = false @@ -54,8 +54,6 @@ primary_color_alpha = "rgba(255, 120, 0, 0.2)" # Whether to use emoji as a favicon. # Replace with an emoji wrapped in quotes. emoji_favicon = false -# Whether the favicon is an animated GIF or not -animated_favicon = false # URL to website's issue tracker issues_url = "https://codeberg.org/daudix/duckquill/issues" # URL to website's source code @@ -117,7 +115,7 @@ show_powered_by = true # Whether to show link to website source show_source = false # Custom copyright text -# copyright = "© Aperture Science Innovators, 1972" +# copyright = "© *Aperture* **Science** ~~Innovators~~, `1972`" # Based on https://carlschwan.eu/2020/12/29/adding-comments-to-your-static-blog-with-mastodon/ # diff --git a/content/_index.md b/content/_index.md index 9d5ef7a..dd57a94 100644 --- a/content/_index.md +++ b/content/_index.md @@ -119,6 +119,10 @@ primary_color = "COLOR_CODE" primary_color_alpha = "COLOR_CODE" ``` +### Favicon + +Files named `favicon.png` and `apple-touch-icon.png` are used as favicon and apple touch icon respectively. For animated favicon you can use APNG with `png` file extension. + ## Test Pages - [Demo page](@/demo/index.md) diff --git a/content/blog/the-quill-of-duck/index.md b/content/blog/the-quill-of-duck/index.md index cffd974..90c58ae 100644 --- a/content/blog/the-quill-of-duck/index.md +++ b/content/blog/the-quill-of-duck/index.md @@ -3,6 +3,7 @@ authors = ["Duck Quack"] title = "The Quill of Duck" description = "This is a Duckquill post example, this post has nothing but a bunch of text and random formatting, acting like a demo." date = 2023-08-31 +updated = "2024-06-21" [taxonomies] tags = ["Demo", "Test"] [extra] diff --git a/i18n/ar.toml b/i18n/ar.toml index 315de82..e9da620 100644 --- a/i18n/ar.toml +++ b/i18n/ar.toml @@ -46,5 +46,6 @@ table_of_contents = "جدول المحتويات" tags = "العلامات" tags_title = "العلامات" trigger_warning = "تحذير الزناد" +updated = "آخر تحديث في" view_comment = "عرض التعليق على" view_profile = "عرض الملف الشخصي على" diff --git a/i18n/en.toml b/i18n/en.toml index 521d667..1949a68 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -50,5 +50,6 @@ one_tags = "$NUMBER tag in total" many_tags = "$NUMBER tags in total" tags_title = "Tags" trigger_warning = "Trigger Warning" +updated = "Last updated on" view_comment = "View comment at" view_profile = "View profile at" diff --git a/i18n/ru.toml b/i18n/ru.toml index 38a07c5..bc20671 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -56,5 +56,6 @@ few_tags = "Всего $NUMBER тега" many_tags = "Всего $NUMBER тегов" tags_title = "Теги" trigger_warning = "Предупреждение о Тревоге" +updated = "Последний раз обновлено" view_comment = "Показать комментарий на" view_profile = "Показать профиль на" diff --git a/templates/anchor-link.html b/templates/anchor-link.html index 06eba02..982d193 100644 --- a/templates/anchor-link.html +++ b/templates/anchor-link.html @@ -1,8 +1 @@ -{% import "macros/translate.html" as macros_translate %} - -{% set language_strings = load_data(path="i18n/" ~ lang ~ '.toml', required=false) %} -{% if not language_strings %} - {% set language_strings = load_data(path="themes/tabi/i18n/" ~ lang ~ ".toml", required=false) %} -{% endif %} - diff --git a/templates/article.html b/templates/article.html index aafc7dd..5d7a57b 100644 --- a/templates/article.html +++ b/templates/article.html @@ -1,36 +1,50 @@ {% extends "base.html" %} {% block content %} -{% set date_format = macros_translate::translate(key="date_format", default="%d %B %Y", language_strings=language_strings) %} -{% set date_locale = macros_translate::translate(key="date_locale", default="en_IE", language_strings=language_strings) %} +{%- set date_format = macros_translate::translate(key="date_format", default="%d %B %Y", language_strings=language_strings) -%} +{%- set date_locale = macros_translate::translate(key="date_locale", default="en_IE", language_strings=language_strings) -%}

{{ page.title }}

- {%- if page.date %} + {%- if page.date -%} - {%- if page.authors %} + {%- if page.updated -%} - {{ macros_translate::translate(key="author", default="Author", language_strings=language_strings) }}: {{ page.authors[0] }} - {%- endif %} - {%- if page.taxonomies %} - {%- for name, taxon in page.taxonomies %} + + {%- endif -%} + {%- if page.authors -%} + + + {{ macros_translate::translate(key="author", default="Author", language_strings=language_strings) }}: + {{ page.authors[0] }} + + {%- endif -%} + {%- if page.taxonomies -%} + {%- for name, taxon in page.taxonomies -%} - {%- endfor %} - {%- endif %} + {%- endfor -%} + {%- endif -%} - {%- endif %} + {%- endif -%} - {% if page.extra.archive %} + {%- if page.extra.archive -%}
@@ -38,9 +52,9 @@ {{ page.extra.archive | markdown | safe }}
- {% endif %} + {%- endif -%} - {% if page.extra.trigger %} + {%- if page.extra.trigger -%}
@@ -48,9 +62,9 @@ {{ page.extra.trigger | markdown | safe }}
- {% endif %} + {%- endif -%} - {% if page.extra.disclaimer %} + {%- if page.extra.disclaimer -%}
@@ -58,59 +72,59 @@ {{ page.extra.disclaimer | markdown | safe }}
- {% endif %} + {%- endif -%} - {% if page.extra.toc %} + {%- if page.extra.toc -%}

{{ macros_translate::translate(key="table_of_contents", default="Table of Contents", language_strings=language_strings) }}

- {% endif %} + {%- endif -%} {{ page.content | safe }}
-{% if page.extra.comments.id %} +{%- if page.extra.comments.id -%} {% include "partials/comments.html" ignore missing %} -{% endif %} +{%- endif -%} -{% if page.lower or page.higher %} +{%- if page.lower or page.higher -%}
-{% endif %} +{%- endif -%}
{{ macros_translate::translate(key="go_to_top", default="Go to Top", language_strings=language_strings) }} - {% if config.extra.issues_url %} + {%- if config.extra.issues_url -%} {{ macros_translate::translate(key="file_an_issue", default="File an Issue", language_strings=language_strings) }} - {% endif %} + {%- endif -%}
{% endblock content %} diff --git a/templates/article_list.html b/templates/article_list.html index c8c8f31..c5ca757 100644 --- a/templates/article_list.html +++ b/templates/article_list.html @@ -1,8 +1,8 @@ {% extends "base.html" %} {% block content %} -{% set date_format = macros_translate::translate(key="date_format", default="%d %B %Y", language_strings=language_strings) %} -{% set date_locale = macros_translate::translate(key="date_locale", default="en_IE", language_strings=language_strings) %} +{%- set date_format = macros_translate::translate(key="date_format", default="%d %B %Y", language_strings=language_strings) -%} +{%- set date_locale = macros_translate::translate(key="date_locale", default="en_IE", language_strings=language_strings) -%}

{{ section.title }}

{{ section.description | markdown | safe }} @@ -16,47 +16,47 @@
- {% for page in section.pages %} + {%- for page in section.pages -%}

{{ page.title }}

- {%- if page.draft %} + {%- if page.draft -%} {{ macros_translate::translate(key="drafted", default="Drafted", language_strings=language_strings) }} - {%- endif %} - {%- if page.extra.archive %} + {%- endif -%} + {%- if page.extra.archive -%} {{ macros_translate::translate(key="archived", default="Archived", language_strings=language_strings) }} - {%- endif %} - {%- if page.description %} + {%- endif -%} + {%- if page.description -%} {{ page.description | markdown | safe }} - {%- endif %} - {%- if page.date %} + {%- endif -%} + {%- if page.date -%} - {%- if page.authors %} + {%- if page.authors -%} {{ macros_translate::translate(key="author", default="Author", language_strings=language_strings) }}: {{ page.authors[0] }} {%- endif %} - {%- if page.taxonomies %} - {%- for name, taxon in page.taxonomies %} + {%- if page.taxonomies -%} + {%- for name, taxon in page.taxonomies -%}
    - {%-for item in taxon %} + {%-for item in taxon -%}
  • {{ item }}
  • - {%- endfor %} + {%- endfor -%}
- {%- endfor %} - {%- endif %} + {%- endfor -%} + {%- endif -%}
- {%- endif %} + {%- endif -%}

- {% endfor %} + {%- endfor -%}
{% endblock content %} diff --git a/templates/base.html b/templates/base.html index 543b2c3..a3075bb 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,10 +1,10 @@ {% import "macros/translate.html" as macros_translate %} -{% set language_strings = load_data(path="i18n/" ~ lang ~ '.toml', required=false) %} -{% if not language_strings %} - {% set language_strings = load_data(path="themes/tabi/i18n/" ~ lang ~ ".toml", required=false) %} -{% endif %} -{% set rtl_languages = ["ar", "arc", "az", "dv", "ff", "he", "ku", "nqo", "fa", "rhg", "syc", "ur"] %} +{%- set language_strings = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%} +{%- if not language_strings -%} + {%- set language_strings = load_data(path="themes/tabi/i18n/" ~ lang ~ ".toml", required=false) -%} +{%- endif -%} +{%- set rtl_languages = ["ar", "arc", "az", "dv", "ff", "he", "ku", "nqo", "fa", "rhg", "syc", "ur"] -%} @@ -12,10 +12,12 @@ {% include "partials/head.html" %} - {% include "partials/nav.html" %} + {%- if config.extra.nav.links %} + {% include "partials/nav.html" %} + {%- endif %}
- {% block custom %}{%- endblock -%} - {% block content %}{%- endblock -%} + {% block custom %}{% endblock %} + {% block content %}{% endblock %}
{% include "partials/footer.html" %} diff --git a/templates/page.html b/templates/page.html index 5170fff..d735404 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -{% if page.extra.archive %} +{%- if page.extra.archive -%}
@@ -9,6 +9,6 @@ {{ page.extra.archive | markdown | safe }}
-{% endif %} +{%- endif -%} {{ page.content | safe }} {% endblock content %} diff --git a/templates/partials/comments.html b/templates/partials/comments.html index 1283abc..149388b 100644 --- a/templates/partials/comments.html +++ b/templates/partials/comments.html @@ -1,32 +1,26 @@ - +{#- Taken from the https://carlschwan.eu/2020/12/29/adding-comments-to-your-static-blog-with-mastodon/ -#} -{% if page.extra.comments.host %} - {% set host = page.extra.comments.host %} -{% else %} - {% set host = config.extra.comments.host %} -{% endif %} +{%- if page.extra.comments.host -%} + {%- set host = page.extra.comments.host -%} +{%- else -%} + {%- set host = config.extra.comments.host -%} +{%- endif -%} -{% if page.extra.comments.user %} - {% set username = page.extra.comments.user %} -{% else %} - {% set username = config.extra.comments.user %} -{% endif %} +{%- if page.extra.comments.user -%} + {%- set username = page.extra.comments.user -%} +{%- else %} + {%- set username = config.extra.comments.user -%} +{%- endif -%} -{% set id = page.extra.comments.id %} -{% set date_locale = macros_translate::translate(key="date_locale", default="en-IE", language_strings=language_strings) | replace(from="_", to="-") %} +{%- set id = page.extra.comments.id -%} +{%- set date_locale = macros_translate::translate(key="date_locale", default="en-IE", language_strings=language_strings) | replace(from="_", to="-") -%}
- {% if config.extra.comments.show_qr %} + {%- if config.extra.comments.show_qr -%} QR code to a Mastodon post - {% endif %} - -

- {{ macros_translate::translate(key="comments", default="Comments", language_strings=language_strings) }} -

-

- {{ macros_translate::translate(key="comments_description", default="You can comment on this blog post by publicly replying to this post using a Mastodon or other ActivityPub/Fediverse account. Known non-private replies are displayed below.", language_strings=language_strings) }} -

- + {%- endif -%} +

{{ macros_translate::translate(key="comments", default="Comments", language_strings=language_strings) }}

+

{{ macros_translate::translate(key="comments_description", default="You can comment on this blog post by publicly replying to this post using a Mastodon or other ActivityPub/Fediverse account. Known non-private replies are displayed below.", language_strings=language_strings) }}

-
- {% endif %} + {%- endif %} - {% if config.extra.show_copy_button %} - {% include "partials/copy-button.html" %} - {% endif %} + {%- if config.extra.show_copy_button %} + {%- set scripts = [ "copy-button.js" ] %} + {%- endif %} - {% if config.extra.scripts %} - {% for script in config.extra.scripts %} - - {% endfor %} - {% endif %} + {%- if config.extra.scripts %} + {%- set scripts = scripts | concat(with=config.extra.scripts) %} + {%- endif %} - {% if config.extra.comments %} + {%- if page.extra.scripts %} + {%- set scripts = scripts | concat(with=page.extra.scripts) %} + {%- elif section.extra.scripts %} + {%- set scripts = scripts | concat(with=section.extra.scripts) %} + {%- endif %} + + {%- for script in scripts %} + + {%- endfor %} + + {%- if config.extra.comments %} - {% endif %} + {%- endif %} - {% if config.extra.emoji_favicon %} + {%- if config.extra.emoji_favicon %} - {% elif config.extra.animated_favicon %} - - {% else %} + {%- else %} - {% endif %} + {%- endif %} - {% if config.generate_feed %} - {% block feed -%} - - {% endblock -%} - {% endif %} + {%- if config.generate_feed %} + + {%- endif %} - diff --git a/templates/partials/language_switcher.html b/templates/partials/language_switcher.html index 38ca47f..b952ea4 100644 --- a/templates/partials/language_switcher.html +++ b/templates/partials/language_switcher.html @@ -2,9 +2,7 @@
- +
    {%- for lcode, ldetails in config.languages -%} diff --git a/templates/partials/nav.html b/templates/partials/nav.html index e124012..4486510 100644 --- a/templates/partials/nav.html +++ b/templates/partials/nav.html @@ -1,4 +1,3 @@ -{% if config.extra.nav.links %} -{% endif %} diff --git a/templates/shortcodes/image.html b/templates/shortcodes/image.html index b170a35..a891b92 100644 --- a/templates/shortcodes/image.html +++ b/templates/shortcodes/image.html @@ -1,4 +1,4 @@ -{% if url_min %} +{%- if url_min -%} -{% else %} +{%- else -%} -{% endif %} +{%- endif -%} diff --git a/templates/shortcodes/video.html b/templates/shortcodes/video.html index 46ce8da..38027c1 100644 --- a/templates/shortcodes/video.html +++ b/templates/shortcodes/video.html @@ -3,5 +3,5 @@ {% if pixels %}pixels{% endif %} {% if transparent %}transparent{% endif %} " - {% if alt %}alt="{{alt}}"{% endif %} + {%- if alt -%}alt="{{alt}}"{%- endif -%} controls src="{{url}}"> diff --git a/templates/taxonomy_list.html b/templates/taxonomy_list.html index 7b7b02e..24ac7a3 100644 --- a/templates/taxonomy_list.html +++ b/templates/taxonomy_list.html @@ -1,14 +1,14 @@ {% extends "base.html" %} {% block content %} -{% set number_of_tags = terms | length %} +{%- set number_of_tags = terms | length -%}

    {{ macros_translate::translate(key="tags_title", default="Tags", language_strings=language_strings) }}

    {{ macros_translate::translate(key="tags", number=number_of_tags, default="$NUMBER tags", language_strings=language_strings) }}
    {% endblock content %} diff --git a/templates/taxonomy_single.html b/templates/taxonomy_single.html index 12c9f34..4803cdc 100644 --- a/templates/taxonomy_single.html +++ b/templates/taxonomy_single.html @@ -1,9 +1,9 @@ {% extends "base.html" %} {% block content %} -{% set date_format = macros_translate::translate(key="date_format", default="%d %B %Y", language_strings=language_strings) %} -{% set date_locale = macros_translate::translate(key="date_locale", default="en_IE", language_strings=language_strings) %} -{% set number_of_posts = term.pages | length %} +{%- set date_format = macros_translate::translate(key="date_format", default="%d %B %Y", language_strings=language_strings) -%} +{%- set date_locale = macros_translate::translate(key="date_locale", default="en_IE", language_strings=language_strings) -%} +{%- set number_of_posts = term.pages | length -%}

    {{ macros_translate::translate(key="posts_with_tag", default="Posts with tag", language_strings=language_strings) }} “{{ term.name }}”

    @@ -15,49 +15,49 @@
    - {% for page in term.pages %} + {%- for page in term.pages -%}

    {{ page.title }}

    - {%- if page.draft %} + {%- if page.draft -%} {{ macros_translate::translate(key="drafted", default="Drafted", language_strings=language_strings) }} - {%- endif %} - {%- if page.extra.archive %} + {%- endif -%} + {%- if page.extra.archive -%} {{ macros_translate::translate(key="archived", default="Archived", language_strings=language_strings) }} - {%- endif %} + {%- endif -%} {%- if page.description %} {{ page.description | markdown | safe }} - {%- endif %} - {%- if page.date %} + {%- endif -%} + {%- if page.date -%} - {%- if page.authors %} + {%- if page.authors -%} {{ macros_translate::translate(key="author", default="Author", language_strings=language_strings) }}: {{ page.authors[0] }} - {%- endif %} - {%- if page.taxonomies %} - {%- for name, taxon in page.taxonomies %} + {%- endif -%} + {%- if page.taxonomies -%} + {%- for name, taxon in page.taxonomies -%}
      - {%-for item in taxon %} + {%-for item in taxon -%}
    • {{ item }}
    • - {%- endfor %} + {%- endfor -%}
    - {%- endfor %} - {%- endif %} + {%- endfor -%} + {%- endif -%}
    - {%- endif %} + {%- endif -%}

    - {% endfor %} + {%- endfor -%}
    {% endblock content %}