From e67bd58ceb1ea5cdac07e3f2170124b063ac555c Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Sun, 14 Nov 2021 00:41:49 -0600 Subject: [PATCH] Add previous and next page links Fix #33 --- assets/css/bobastyle.css | 47 ++++++++++++++++++++++++++++++++++++ layouts/_default/single.html | 30 +++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/assets/css/bobastyle.css b/assets/css/bobastyle.css index 2021a5b..e5b8a31 100644 --- a/assets/css/bobastyle.css +++ b/assets/css/bobastyle.css @@ -411,6 +411,53 @@ li.disabled > .page-link:hover { +/* Previous and next page */ +.prevnext { + display: flex; + margin: 20px 0; +} + +.prevnext > * { + flex: 1; + white-space: nowrap; + overflow: hidden; + display: flex; + flex-direction: column; + color: inherit; + background-color: #222; + padding: 8px 16px; +} + +.prevnext > a:hover { + background-color: #333; + text-decoration: none; +} + +.prevnext > .prev { + text-align: left; + border-top-left-radius: 8px; + border-bottom-left-radius: 8px; +} + +.prevnext > .next { + text-align: right; + border-top-right-radius: 8px; + border-bottom-right-radius: 8px; +} + +.prevnext .prev-caption, +.prevnext .next-caption { + opacity: 65%; +} + +.prevnext .prev-post, +.prevnext .next-post { + overflow: hidden; + text-overflow: ellipsis; +} + + + /* Print compatibility */ @media print { .top, diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 7b5486c..7231977 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -52,6 +52,36 @@ {{ end }} +{{ if or .NextInSection .PrevInSection }} +
+ {{ with .NextInSection }} + + {{ else }} + + {{ end }} + + {{ with .PrevInSection }} + + {{ else }} + + {{ end }} +
+{{ end }} + {{ if .Params.comments }} {{ partial "comments.html" . }} {{ end }}