chore: Merge latest changes from the main branch

This commit is contained in:
Jeremiah Russell 2025-04-30 10:39:37 +01:00
commit bb411abfc2
No known key found for this signature in database
GPG key ID: E576B835ACE207E5
39 changed files with 1064 additions and 435 deletions

View file

@ -1,11 +1,13 @@
{% import "macros/feed_utils.html" as feed_utils %}
{% import "macros/format_date.html" as macros_format_date %}
{% import "macros/list_posts.html" as macros_list_posts %}
{% import "macros/page_header.html" as macros_page_header %}
{% import "macros/rel_attributes.html" as macros_rel_attributes %}
{% import "macros/series_page.html" as macros_series_page %}
{% import "macros/settings.html" as macros_settings %}
{% import "macros/table_of_contents.html" as macros_toc %}
{% import "macros/target_attribute.html" as macros_target_attribute %}
{% import "macros/translate.html" as macros_translate %}
{% import "macros/series_page.html" as macros_series_page %}
{# Load the internationalisation data for the current language from
the .toml files in the user's '/i18n' folder, falling back to the theme's.

View file

@ -0,0 +1,17 @@
{#- Feed utility macros -#}
{#- Zola 0.19.0 uses `generate_feeds`. Prior versions use `generate_feed` -#}
{%- macro get_generate_feed() -%}
{{- config.generate_feeds | default(value=config.generate_feed) -}}
{%- endmacro get_generate_feed -%}
{%- macro get_feed_url() -%}
{{- config.feed_filenames[0] | default(value=(config.feed_filename)) -}}
{%- endmacro get_feed_url -%}
{#- Check footer feed icon conditions -#}
{%- macro should_show_footer_feed_icon() -%}
{%- set generate_feed = feed_utils::get_generate_feed() -%}
{%- set feed_url = feed_utils::get_feed_url() -%}
{{- generate_feed and config.extra.feed_icon and feed_url -}}
{%- endmacro should_show_footer_feed_icon -%}

View file

@ -83,7 +83,7 @@
<li class="date">{{- macros_format_date::format_date(date=post.date, short=false, language_strings=language_strings) -}}</li>
{%- endif -%}
{%- if show_date and show_updated -%}
<li class="mobile-only">{{- separator -}}</li>
<li class="mobile-only separator">{{- separator -}}</li>
{%- endif -%}
{%- if show_updated -%}
{%- set last_updated_str = macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -%}
@ -142,9 +142,9 @@
<div class="description">
{% if post.description %}
<p>{{ post.description }}</p>
<p>{{ post.description | markdown(inline=true) | safe }}</p>
{% elif post.summary %}
<p>{{ post.summary | striptags | trim_end_matches(pat=".") | safe }}…</p>
<p>{{ post.summary | markdown(inline=true) | trim_end_matches(pat=".") | safe }}…</p>
{% endif %}
</div>
<a class="readmore" href="{{ post.permalink }}">{{ macros_translate::translate(key="read_more", default="Read more", language_strings=language_strings) }}&nbsp;<span class="arrow"></span></a>

View file

@ -1,5 +1,18 @@
{% macro page_header(title) %}
{% macro page_header(title, show_feed_icon=false) %}
{% set rel_attributes = macros_rel_attributes::rel_attributes() | trim %}
{%- set blank_target = macros_target_attribute::target_attribute(new_tab=config.markdown.external_links_target_blank) -%}
<h1 class="title-container section-title bottom-divider">
{{ title }}
{{ title -}}
{% if show_feed_icon %}
{%- set feed_url = feed_utils::get_feed_url() -%}
<a class="no-hover-padding social" rel="{{ rel_attributes }}" {{ blank_target }} href="{{ get_url(path=term.path ~ feed_url, lang=lang, trailing_slash=false) | safe }}">
<img loading="lazy" alt="feed" title="feed" src="{{ get_url(path='/social_icons/rss.svg') }}">
</a>
{% endif %}
</h1>
{% endmacro page_header %}

View file

@ -0,0 +1,11 @@
{% macro target_attribute(new_tab) %}
{%- set blank_target = "" -%}
{%- if new_tab -%}
{%- set blank_target = "target=_blank" -%}
{%- endif -%}
{{ blank_target }}
{% endmacro target_attribute %}

View file

@ -5,11 +5,7 @@
{%- set rel_attributes = macros_rel_attributes::rel_attributes() | trim -%}
{%- if config.markdown.external_links_target_blank -%}
{%- set blank_target = "target=_blank" -%}
{%- else -%}
{%- set blank_target = "" -%}
{%- endif -%}
{%- set blank_target = macros_target_attribute::target_attribute(new_tab=config.markdown.external_links_target_blank) -%}
{# Debugging #}
{# <div><pre>

View file

@ -7,11 +7,7 @@
{% break %}
{% endif %}
{# Determine which URL to use, default is page.permalink #}
{%- if page.extra.link_to and config.markdown.external_links_target_blank -%}
{%- set blank_target = "target=_blank" -%}
{%- else -%}
{%- set blank_target = "" -%}
{%- endif -%}
{%- set blank_target = macros_target_attribute::target_attribute(new_tab=config.markdown.external_links_target_blank and page.extra.link_to) -%}
{% set target_url = page.extra.link_to | default(value=page.permalink) %}

View file

@ -2,17 +2,11 @@
{%- set rel_attributes = macros_rel_attributes::rel_attributes() | trim -%}
{%- if config.markdown.external_links_target_blank -%}
{%- set blank_target = "target=_blank" -%}
{%- else -%}
{%- set blank_target = "" -%}
{%- endif -%}
{%- set blank_target = macros_target_attribute::target_attribute(new_tab=config.markdown.external_links_target_blank) -%}
{#- Feed icon -#}
{#- Zola 0.19.0 uses `generate_feeds`. Prior versions use `generate_feed` -#}
{%- set generate_feed = config.generate_feeds | default(value=config.generate_feed) -%}
{%- set feed_url = config.feed_filenames[0] | default(value=(config.feed_filename)) -%}
{%- set should_show_feed = generate_feed and config.extra.feed_icon and feed_url -%}
{%- set feed_url = feed_utils::get_feed_url() -%}
{%- set should_show_feed = feed_utils::should_show_footer_feed_icon() -%}
{%- set should_show_footer_icons = should_show_feed or config.extra.socials or config.extra.email -%}

View file

@ -0,0 +1,75 @@
{%- set hcard = config.extra.hcard -%}
{% set full_name = config.author %}
{% if hcard.full_name %}
{% set full_name = hcard.full_name %}
{% endif %}
{%- set homepage = config.base_url -%}
{% if hcard.homepage %}
{%- set homepage = hcard.homepage -%}
{% endif %}
{% if hcard.enable %}
<div class="h-card hidden">
<div>
{%- if hcard.avatar -%}
<img
class="u-photo"
src="{{ get_url(path=hcard.avatar) }}"
width="200"
height="200"
alt="{{ full_name }}"
/>
{%- endif -%}
<span class="p-name" rel="me">{{ full_name }}</span>
{% if hcard.p_nickname %}
( <span class="p-nickname">{{ hcard.p_nickname }}</span> )
{% endif %}
</div>
{% if hcard.biography %}
<p class="p-note">{{ hcard.biography }}</p>
{% endif %}
{# links #}
<div>
{%- if hcard.with_mail and config.extra.email and not config.extra.encode_plaintext_email -%}
<span>
<a class="u-email" href="mailto:{{ config.extra.email | safe }}">email</a>
</span> -
{%- endif -%}
<span>
<a class="u-url u-id" href="{{ homepage }}">homepage</a>
</span> -
{%- if hcard.with_social_links and config.extra.socials %}
{% for social in config.extra.socials %}
<span>
<a class="p-url" rel="me" href="{{ social.url | safe }}">{{ social.name }}</a>
</span> -
{% endfor %}
{% endif %}
</div>
{# additional properties #}
{% set dl_started = false %}
{% for key, value in hcard %}
{% if key not in ['enable', 'with_mail', 'with_social_links', 'homepage', 'full_name', 'avatar', 'biography', 'p_nickname'] %}
{% if not dl_started %}
<dl>
{% set_global dl_started = true %}
{% endif %}
<dt>{{ key | replace(from="p_", to="") | replace(from="u_", to="") | replace(from="dt_", to="") | replace(from="_", to=" ") | capitalize }}</dt>
<dd class="{{ key | replace(from="_", to="-") }}">{{ value }}</dd>
{% endif %}
{% endfor %}
{% if dl_started %}
</dl>
{% endif %}
</div>
{% endif %}

View file

@ -1,4 +1,7 @@
{#- Setup -#}
{% if not config.title %}
{{ throw(message="ERROR: No `title` set in `config.toml`. tabi requires a title to function.") }}
{% endif %}
{%- set prefix = config.title | safe -%}
{%- set custom_separator = config.extra.separator | default(value="•") -%}
{%- set separator = " " ~ custom_separator ~ " " -%}

View file

@ -24,6 +24,9 @@
{%- endif -%}
<main {% if more_than_one_section_shown %}class="{{ first_section }}-first"{% endif %}>
{%- if config.extra.hcard %}
{%- include "partials/hcard.html" -%}
{% endif -%}
{%- if section.extra.header %}
{%- include "partials/home_banner.html" -%}
{%- elif section.content -%}

View file

@ -9,9 +9,9 @@
{#- Fallback to absolute path if relative path doesn't work -#}
{%- if not meta -%}
{%- set meta = get_image_metadata(path=src, allow_missing=true) -%}
{%- set image_url = get_url(path=src) -%}
{%- set image_url = get_url(path=src, cachebust=true) -%}
{%- else -%}
{%- set image_url = get_url(path=relative_path) -%}
{%- set image_url = get_url(path=relative_path, cachebust=true) -%}
{%- endif -%}
{%- endif -%}

View file

@ -16,9 +16,9 @@
{%- set relative_light_path = colocated_path ~ light_src -%}
{%- set light_meta = get_image_metadata(path=relative_light_path, allow_missing=true) -%}
{%- if not light_meta -%}
{%- set light_image_url = get_url(path=light_src) -%}
{%- set light_image_url = get_url(path=light_src, cachebust=true) -%}
{%- else -%}
{%- set light_image_url = get_url(path=relative_light_path) -%}
{%- set light_image_url = get_url(path=relative_light_path, cachebust=true) -%}
{%- endif -%}
{%- endif -%}
@ -29,9 +29,9 @@
{%- set relative_dark_path = colocated_path ~ dark_src -%}
{%- set dark_meta = get_image_metadata(path=relative_dark_path, allow_missing=true) -%}
{%- if not dark_meta -%}
{%- set dark_image_url = get_url(path=dark_src) -%}
{%- set dark_image_url = get_url(path=dark_src, cachebust=true) -%}
{%- else -%}
{%- set dark_image_url = get_url(path=relative_dark_path) -%}
{%- set dark_image_url = get_url(path=relative_dark_path, cachebust=true) -%}
{%- endif -%}
{%- endif -%}

View file

@ -9,9 +9,9 @@
{#- Fallback to absolute path if relative path doesn't work -#}
{%- if not meta -%}
{%- set meta = get_image_metadata(path=src, allow_missing=true) -%}
{%- set image_url = get_url(path=src) -%}
{%- set image_url = get_url(path=src, cachebust=true) -%}
{%- else %}
{%- set image_url = get_url(path=relative_path) -%}
{%- set image_url = get_url(path=relative_path, cachebust=true) -%}
{%- endif -%}
{%- endif -%}

View file

@ -21,9 +21,9 @@
{%- set relative_default_path = colocated_path ~ default_src -%}
{%- set default_meta = get_image_metadata(path=relative_default_path, allow_missing=true) -%}
{%- if not default_meta -%}
{%- set default_image_url = get_url(path=default_src) -%}
{%- set default_image_url = get_url(path=default_src, cachebust=true) -%}
{%- else -%}
{%- set default_image_url = get_url(path=relative_default_path) -%}
{%- set default_image_url = get_url(path=relative_default_path, cachebust=true) -%}
{%- endif -%}
{%- endif -%}
@ -34,9 +34,9 @@
{%- set relative_hovered_path = colocated_path ~ hovered_src -%}
{%- set hovered_meta = get_image_metadata(path=relative_hovered_path, allow_missing=true) -%}
{%- if not hovered_meta -%}
{%- set hovered_image_url = get_url(path=hovered_src) -%}
{%- set hovered_image_url = get_url(path=hovered_src, cachebust=true) -%}
{%- else -%}
{%- set hovered_image_url = get_url(path=relative_hovered_path) -%}
{%- set hovered_image_url = get_url(path=relative_hovered_path, cachebust=true) -%}
{%- endif -%}
{%- endif -%}

View file

@ -25,9 +25,9 @@
{%- set relative_default_path = colocated_path ~ default_src -%}
{%- set default_meta = get_image_metadata(path=relative_default_path, allow_missing=true) -%}
{%- if not default_meta -%}
{%- set default_image_url = get_url(path=default_src) -%}
{%- set default_image_url = get_url(path=default_src, cachebust=true) -%}
{%- else -%}
{%- set default_image_url = get_url(path=relative_default_path) -%}
{%- set default_image_url = get_url(path=relative_default_path, cachebust=true) -%}
{%- endif -%}
{%- endif -%}
@ -38,9 +38,9 @@
{%- set relative_toggled_path = colocated_path ~ toggled_src -%}
{%- set toggled_meta = get_image_metadata(path=relative_toggled_path, allow_missing=true) -%}
{%- if not toggled_meta -%}
{%- set toggled_image_url = get_url(path=toggled_src) -%}
{%- set toggled_image_url = get_url(path=toggled_src, cachebust=true) -%}
{%- else -%}
{%- set toggled_image_url = get_url(path=relative_toggled_path) -%}
{%- set toggled_image_url = get_url(path=relative_toggled_path, cachebust=true) -%}
{%- endif -%}
{%- endif -%}

View file

@ -9,9 +9,9 @@
{#- Fallback to absolute path if relative path doesn't work -#}
{%- if not meta -%}
{%- set meta = get_image_metadata(path=src, allow_missing=true) -%}
{%- set image_url = get_url(path=src) -%}
{%- set image_url = get_url(path=src, cachebust=true) -%}
{%- else %}
{%- set image_url = get_url(path=relative_path) -%}
{%- set image_url = get_url(path=relative_path, cachebust=true) -%}
{%- endif -%}
{%- endif -%}

View file

@ -2,7 +2,13 @@
{% block main_content %}
{{ macros_page_header::page_header(title=term.name) }}
{#- Feed icon -#}
{%- set generate_feed = feed_utils::get_generate_feed() -%}
{%- set feed_url = feed_utils::get_feed_url() -%}
{%- set feed_pre_conditions = generate_feed and feed_url and taxonomy.feed -%}
{%- set show_feed_icon = feed_pre_conditions and term.pages | filter(attribute="date") -%}
{{ macros_page_header::page_header(title=term.name, show_feed_icon=show_feed_icon) }}
{% set max = section.extra.max_posts | default(value=999999) %}
{{ macros_list_posts::list_posts(posts=term.pages, max=max, language_strings=language_strings) }}

View file

@ -2,7 +2,13 @@
{% block main_content %}
{{ macros_page_header::page_header(title=term.name) }}
{#- Feed icon -#}
{%- set generate_feed = feed_utils::get_generate_feed() -%}
{%- set feed_url = feed_utils::get_feed_url() -%}
{%- set feed_pre_conditions = generate_feed and feed_url and taxonomy.feed -%}
{%- set show_feed_icon = feed_pre_conditions and term.pages | filter(attribute="date") | length > 0 -%}
{{ macros_page_header::page_header(title=term.name, show_feed_icon=show_feed_icon) }}
{% set max = section.extra.max_posts | default(value=999999) %}
{{ macros_list_posts::list_posts(posts=term.pages, max=max, language_strings=language_strings) }}