From 122814997ed22e80e486e8bdd322f299bf6cdb29 Mon Sep 17 00:00:00 2001 From: Yaro Date: Sat, 14 Nov 2020 15:17:22 +0000 Subject: [PATCH] links_to_prev_next.html --- README.md | 3 +++ _includes/links_to_prev_next.html | 13 +++++++++++++ _layouts/post.html | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 _includes/links_to_prev_next.html diff --git a/README.md b/README.md index 1c16bcf695..d37fc9f9f5 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,9 @@ minima: date_format: "%b %-d, %Y" ``` +### Add links to previous and next post + +in `_config.yml`: `links_to_prev_next: true` (default is `false`) ### Extending the `` diff --git a/_includes/links_to_prev_next.html b/_includes/links_to_prev_next.html new file mode 100644 index 0000000000..bd7edae6f8 --- /dev/null +++ b/_includes/links_to_prev_next.html @@ -0,0 +1,13 @@ +
+
+

+ {% if page.previous.url %} + ⇠ {{page.previous.title}} + {% endif %} +

+

+ {% if page.next.url %} + {{page.next.title}} ⇢ + {% endif %} +

+
diff --git a/_layouts/post.html b/_layouts/post.html index c9a03be7ba..fb16140ba5 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -30,6 +30,10 @@

{{ page.title | escape }} {{ content }} + {%- if site.links_to_prev_next -%} + {%- include links_to_prev_next.html -%} + {%- endif -%} + {%- if site.disqus.shortname -%} {%- include disqus_comments.html -%} {%- endif -%}