forked from deepStateMirrors/tabi
✨ feat(feed): add feed icon tag pages (#522)
Co-authored-by: welpo <welpo@users.noreply.github.com>
This commit is contained in:
parent
93af295d78
commit
c4f39d7643
8 changed files with 55 additions and 11 deletions
|
@ -196,7 +196,7 @@ article {
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
display: block;
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-top: -0.15em;
|
margin-top: -0.15em;
|
||||||
color: var(--text-color-high-contrast);
|
color: var(--text-color-high-contrast);
|
||||||
|
|
|
@ -48,6 +48,9 @@ ul {
|
||||||
|
|
||||||
.title-container {
|
.title-container {
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
|
.social {
|
||||||
|
margin-inline-start: 0.5rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-divider {
|
.bottom-divider {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
{% import "macros/feed_utils.html" as feed_utils %}
|
||||||
{% import "macros/format_date.html" as macros_format_date %}
|
{% import "macros/format_date.html" as macros_format_date %}
|
||||||
{% import "macros/list_posts.html" as macros_list_posts %}
|
{% import "macros/list_posts.html" as macros_list_posts %}
|
||||||
{% import "macros/page_header.html" as macros_page_header %}
|
{% import "macros/page_header.html" as macros_page_header %}
|
||||||
{% import "macros/rel_attributes.html" as macros_rel_attributes %}
|
{% 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/settings.html" as macros_settings %}
|
||||||
{% import "macros/table_of_contents.html" as macros_toc %}
|
{% import "macros/table_of_contents.html" as macros_toc %}
|
||||||
{% import "macros/translate.html" as macros_translate %}
|
|
||||||
{% import "macros/series_page.html" as macros_series_page %}
|
|
||||||
{% import "macros/target_attribute.html" as macros_target_attribute %}
|
{% import "macros/target_attribute.html" as macros_target_attribute %}
|
||||||
|
{% import "macros/translate.html" as macros_translate %}
|
||||||
|
|
||||||
{# Load the internationalisation data for the current language from
|
{# Load the internationalisation data for the current language from
|
||||||
the .toml files in the user's '/i18n' folder, falling back to the theme's.
|
the .toml files in the user's '/i18n' folder, falling back to the theme's.
|
||||||
|
|
17
templates/macros/feed_utils.html
Normal file
17
templates/macros/feed_utils.html
Normal 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 -%}
|
|
@ -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">
|
<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>
|
</h1>
|
||||||
|
|
||||||
{% endmacro page_header %}
|
{% endmacro page_header %}
|
||||||
|
|
|
@ -5,10 +5,8 @@
|
||||||
{%- set blank_target = macros_target_attribute::target_attribute(new_tab=config.markdown.external_links_target_blank) -%}
|
{%- set blank_target = macros_target_attribute::target_attribute(new_tab=config.markdown.external_links_target_blank) -%}
|
||||||
|
|
||||||
{#- Feed icon -#}
|
{#- Feed icon -#}
|
||||||
{#- Zola 0.19.0 uses `generate_feeds`. Prior versions use `generate_feed` -#}
|
{%- set feed_url = feed_utils::get_feed_url() -%}
|
||||||
{%- set generate_feed = config.generate_feeds | default(value=config.generate_feed) -%}
|
{%- set should_show_feed = feed_utils::should_show_footer_feed_icon() -%}
|
||||||
{%- 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 should_show_footer_icons = should_show_feed or config.extra.socials or config.extra.email -%}
|
{%- set should_show_footer_icons = should_show_feed or config.extra.socials or config.extra.email -%}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
|
|
||||||
{% block main_content %}
|
{% 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) %}
|
{% set max = section.extra.max_posts | default(value=999999) %}
|
||||||
{{ macros_list_posts::list_posts(posts=term.pages, max=max, language_strings=language_strings) }}
|
{{ macros_list_posts::list_posts(posts=term.pages, max=max, language_strings=language_strings) }}
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
|
|
||||||
{% block main_content %}
|
{% 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) %}
|
{% set max = section.extra.max_posts | default(value=999999) %}
|
||||||
{{ macros_list_posts::list_posts(posts=term.pages, max=max, language_strings=language_strings) }}
|
{{ macros_list_posts::list_posts(posts=term.pages, max=max, language_strings=language_strings) }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue