🐛 fix: link 'All posts' to proper section (#295)

Co-authored-by: Daniel Kessler (a.k.a. Dalker) <daniel.kessler@dalker.org>
Co-authored-by: welpo <welpo@users.noreply.github.com>
main
Daniel Kessler 10 months ago committed by GitHub
parent 07bd0e17ea
commit 9249d9fbbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,4 +1,4 @@
{% macro list_posts(posts, max, language_strings="") %} {% macro list_posts(posts, max, language_strings="", section_path="blog") %}
<div class="bloglist-container"> <div class="bloglist-container">
{% for post in posts %} {% for post in posts %}
@ -46,7 +46,7 @@
{% if not loop.last %} {% if not loop.last %}
{% if loop.index == max %} {% if loop.index == max %}
<div class="all-posts"> <div class="all-posts">
<a href="{{ get_url(path="blog", lang=lang) }}/">{{ macros_translate::translate(key="all_posts", default="All posts", language_strings=language_strings) }}&nbsp;<span class="arrow"></span></a> <a href="{{ get_url(path=section_path, lang=lang) }}/">{{ macros_translate::translate(key="all_posts", default="All posts", language_strings=language_strings) }}&nbsp;<span class="arrow"></span></a>
</div> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}

@ -7,6 +7,12 @@
{% set extra_section = get_section(path=section.extra.section_path) %} {% set extra_section = get_section(path=section.extra.section_path) %}
{% endif -%} {% endif -%}
{% if section.extra.section_path -%}
{% set path = section.extra.section_path | replace(from="/_index.md", to = "") %}
{% else -%}
{% set path = section.path %}
{% endif -%}
{%- if section.extra.header %} {%- if section.extra.header %}
{%- include "partials/home_banner.html" -%} {%- include "partials/home_banner.html" -%}
{% endif -%} {% endif -%}
@ -23,7 +29,7 @@
{% endif -%} {% endif -%}
{% set max = section.extra.max_posts | default(value=999999) %} {% set max = section.extra.max_posts | default(value=999999) %}
{{ macros_list_posts::list_posts(posts=pages, max=max, language_strings=language_strings) }} {{ macros_list_posts::list_posts(posts=pages, max=max, language_strings=language_strings, section_path=path) }}
</div> </div>
</main> </main>

Loading…
Cancel
Save