Skip to content

Commit

Permalink
🐛 fix: link 'All posts' to proper section (#295)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Kessler (a.k.a. Dalker) <[email protected]>
Co-authored-by: welpo <[email protected]>
  • Loading branch information
3 people authored Apr 18, 2024
1 parent 07bd0e1 commit 9249d9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions templates/macros/list_posts.html
Original file line number Diff line number Diff line change
@@ -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">
{% for post in posts %}
Expand Down Expand Up @@ -46,7 +46,7 @@ <h2 class="bloglist-title">
{% if not loop.last %}
{% if loop.index == max %}
<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>
{% endif %}
{% endif %}
Expand Down
8 changes: 7 additions & 1 deletion templates/section.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
{% set extra_section = get_section(path=section.extra.section_path) %}
{% 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 %}
{%- include "partials/home_banner.html" -%}
{% endif -%}
Expand All @@ -23,7 +29,7 @@
{% endif -%}

{% 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>
</main>

Expand Down

0 comments on commit 9249d9f

Please sign in to comment.