Turn "Feed" button to a dropdown if multiple feeds are avaiable (fixes #72)

This commit is contained in:
daudix
2024-09-14 04:02:11 +03:00
parent a1946ae0b2
commit 7df26217f8
3 changed files with 25 additions and 2 deletions

View File

@ -130,7 +130,7 @@
{%- set scripts = scripts | concat(with=["theme-switcher.js"]) %}
{%- endif %}
{%- if config.extra.nav.links.menu or config.languages | length > 0 or config.extra.nav.show_theme_switcher %}
{%- if config.extra.nav.links.menu or config.languages | length > 0 or config.extra.nav.show_theme_switcher or config.feed_filenames | length > 1 and config.extra.nav.show_feed %}
{%- set scripts = scripts | concat(with=["details.js"]) %}
{%- endif %}

View File

@ -105,7 +105,28 @@
</details>
</li>
{%- endif %}
{%- if config.generate_feeds and config.extra.nav.show_feed %}
{%- if config.feed_filenames | length > 1 and config.extra.nav.show_feed -%}
<li id="feed">
<details>
<summary class="circle" title="{{ macros_translate::translate(key='feed', default='Feed', language_strings=language_strings) }}">
<i class="icon"></i>
</summary>
<ul>
{%- for feed in config.feed_filenames %}
<li>
<a href="{{ get_url(path=feed, lang=lang) }}" rel="{{ rel_attributes }}">
{%- if feed == "rss.xml" -%}
RSS
{%- elif feed == "atom.xml" -%}
Atom
{%- endif -%}
</a>
</li>
{%- endfor -%}
</ul>
</details>
</li>
{%- elif config.generate_feeds and config.extra.nav.show_feed %}
<li id="feed">
<a class="circle" href="{{ get_url(path=config.feed_filenames[0], lang=lang) }}" title="{{ macros_translate::translate(key='feed', default='Feed', language_strings=language_strings) }}">
<i class="icon"></i>