Skip to content

Commit cc44b3a

Browse files
authored
Fix footer overlap issue on blog posts with navigation (#342)
* feat: Wrap prev-next partial in post-navigation container * feat: Apply clear fix to post navigation * feat: Add consistent spacing between post navigation and post content * feat: Adjust spacing for floats when post navigation is enabled * refactor: Remove has pseudo class from body and ensure scope * refactor: Change div tag to nav and add aria label * refactor: Alphabatize declarations in clearfix rule
1 parent 55446ef commit cc44b3a

File tree

2 files changed

+43
-27
lines changed

2 files changed

+43
-27
lines changed

assets/css/main.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ body {
3434
margin-bottom: 170px;
3535
}
3636

37+
body.blog-post.has-post-navigation {
38+
margin-bottom: 80px;
39+
}
40+
3741
b,
3842
strong {
3943
font-weight: bold;
@@ -640,6 +644,16 @@ table td {
640644
overflow: hidden;
641645
}
642646

647+
.post-navigation {
648+
padding: 40px 0;
649+
}
650+
651+
.post-navigation::after {
652+
clear: both;
653+
content: "";
654+
display: table;
655+
}
656+
643657
.prev-post {
644658
float: left;
645659
text-align: left;

layouts/partials/prev-next.html

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
{{ with .PrevInSection }}
2-
<div class="prev-post">
3-
<p>
4-
<a href="{{ .RelPermalink }}">
5-
&#8592;
6-
{{ i18n "previous" }}:
7-
{{ .Title | markdownify }}
8-
</a>
9-
</p>
10-
<p class="prev-post-date">
11-
{{ dateFormat (or .Site.Params.dateFormat "January 2, 2006") .Date}}
12-
</p>
13-
</div>
14-
{{ end }}
15-
16-
{{ with .NextInSection }}
17-
<div class="next-post">
18-
<p>
19-
<a href="{{ .RelPermalink }}">
20-
{{ i18n "next" }}:
21-
{{ .Title | markdownify }}
22-
&#8594;
23-
</a>
24-
</p>
25-
<p class="next-post-date">
1+
<nav aria-label="Post navigation" class="post-navigation">
2+
{{ with .PrevInSection }}
3+
<div class="prev-post">
4+
<p>
5+
<a href="{{ .RelPermalink }}">
6+
&#8592;
7+
{{ i18n "previous" }}:
8+
{{ .Title | markdownify }}
9+
</a>
10+
</p>
11+
<p class="prev-post-date">
2612
{{ dateFormat (or .Site.Params.dateFormat "January 2, 2006") .Date}}
2713
</p>
28-
</div>
29-
{{ end }}
14+
</div>
15+
{{ end }}
16+
17+
{{ with .NextInSection }}
18+
<div class="next-post">
19+
<p>
20+
<a href="{{ .RelPermalink }}">
21+
{{ i18n "next" }}:
22+
{{ .Title | markdownify }}
23+
&#8594;
24+
</a>
25+
</p>
26+
<p class="next-post-date">
27+
{{ dateFormat (or .Site.Params.dateFormat "January 2, 2006") .Date}}
28+
</p>
29+
</div>
30+
{{ end }}
31+
</nav>

0 commit comments

Comments
 (0)