feat: add previous/next article navigation (#246)

This commit is contained in:
Óscar
2024-01-04 19:05:06 +01:00
committed by GitHub
parent 0aef23b370
commit dac6bfc024
12 changed files with 90 additions and 0 deletions

View File

@@ -22,6 +22,7 @@
"show_reading_time",
"show_remote_changes",
"toc",
"show_previous_next_article_links",
] %}
<table>
@@ -129,6 +130,23 @@
{{ throw(message="ERROR: Multiple comment systems have been enabled for the same page. Check your config.toml and individual page settings to ensure only one comment system is activated at a time.") }}
{% endif %}
{% if macros_settings::evaluate_setting_priority(setting="show_previous_next_article_links", page=page, default_global_value=true) == "true" %}
{%- if page.lower or page.higher -%}
<nav class="full-width article-navigation">
<div>
{%- if page.lower -%}
<a href="{{ page.lower.permalink | safe }}">&#8249; {{ page.lower.title | truncate(length=100) }}</a>
{%- endif -%}
</div>
<div>
{%- if page.higher -%}
<a href="{{ page.higher.permalink | safe }}"> {{ page.higher.title | truncate(length=100) }} &#8250;</a>
{%- endif -%}
</div>
</nav>
{%- endif -%}
{%- endif -%}
{% if comment_system %}
{% include "partials/comments.html" %}
{% endif %}