Skip to content

Commit 41b8f9f

Browse files
committed
feat(layout): center the footer
1 parent 62bcd60 commit 41b8f9f

File tree

9 files changed

+77
-141
lines changed

9 files changed

+77
-141
lines changed

_includes/footer.html

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
<!-- The Footer -->
22

3-
<footer>
4-
<div class="container px-lg-4">
5-
<div class="d-flex justify-content-center align-items-center text-muted mx-md-3">
6-
<p>
7-
{%- capture _platform -%}
8-
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
9-
{%- endcapture -%}
3+
<footer
4+
class="
5+
d-flex flex-column justify-content-center text-muted
6+
flex-lg-row justify-content-lg-between align-items-lg-center pb-lg-3
7+
"
8+
>
9+
<p>
10+
{{ '©' }}
11+
{{ 'now' | date: '%Y' }}
12+
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
13+
{% if site.data.locales[include.lang].copyright.brief %}
14+
<span
15+
data-bs-toggle="tooltip"
16+
data-bs-placement="top"
17+
title="{{ site.data.locales[include.lang].copyright.verbose }}"
18+
>
19+
{{- site.data.locales[include.lang].copyright.brief -}}
20+
</span>
21+
{% endif %}
22+
</p>
1023

11-
{%- capture _theme -%}
12-
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
13-
{%- endcapture -%}
24+
<p>
25+
{%- capture _platform -%}
26+
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
27+
{%- endcapture -%}
1428

15-
{{ site.data.locales[include.lang].meta | replace: ':PLATFORM', _platform | replace: ':THEME', _theme }}
16-
</p>
29+
{%- capture _theme -%}
30+
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
31+
{%- endcapture -%}
1732

18-
<p>
19-
{{- '©' }}
20-
{{ 'now' | date: '%Y' }}
21-
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
22-
{% if site.data.locales[include.lang].copyright.brief %}
23-
<span
24-
data-bs-toggle="tooltip"
25-
data-bs-placement="top"
26-
title="{{ site.data.locales[include.lang].copyright.verbose }}"
27-
>
28-
{{- site.data.locales[include.lang].copyright.brief -}}
29-
</span>
30-
{% endif %}
31-
</p>
32-
</div>
33-
</div>
33+
{{ site.data.locales[include.lang].meta | replace: ':PLATFORM', _platform | replace: ':THEME', _theme }}
34+
</p>
3435
</footer>

_includes/related-posts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
{% if relate_posts.size > 0 %}
7272
<div id="related-posts" class="mb-2 mb-sm-4">
73-
<h3 class="pt-2 mb-4 ms-1" data-toc-skip>
73+
<h3 class="pt-2 mb-4" data-toc-skip>
7474
{{ site.data.locales[include.lang].post.relate_posts }}
7575
</h3>
7676
<div class="row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4 mb-4">

_layouts/default.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
</div>
3131
</div>
3232

33-
{% include_cached footer.html lang=lang %}
34-
3533
<div id="mask"></div>
3634

3735
<button id="back-to-top" aria-label="back-to-top" class="btn btn-lg btn-box-shadow">

_layouts/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
{% endfor %}
4141
{% endif %}
4242

43-
<div id="post-list">
43+
<div id="post-list" class="pe-xl-2">
4444
{% for post in posts %}
4545
<a href="{{ post.url | relative_url }}" class="card-wrapper">
4646
<div class="card post-preview flex-md-row-reverse">

_layouts/page.html

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
{% assign has_tail = true %}
1010
{% endif %}
1111

12-
<div class="row{% unless has_tail %} mb-5{% endunless %}">
12+
<div class="row">
1313
<!-- core -->
14-
<div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pe-xl-4">
14+
<div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 px-md-4">
1515
{% capture padding %}
1616
{% unless page.layout == 'home' %}px-1{% endunless %}
1717
{% endcapture %}
1818

19-
<div class="post {{ padding | strip }} px-md-2">
19+
<div class="post {{ padding | strip }} {% unless has_tail %} flex-grow-1 mb-5{% endunless %}">
2020
{% capture _content %}
21-
{% if layout.refactor or page.layout == 'page' %}
22-
{% include refactor-content.html content=content lang=lang %}
23-
{% else %}
24-
{{ content }}
25-
{% endif %}
26-
{% endcapture %}
21+
{% if layout.refactor or page.layout == 'page' %}
22+
{% include refactor-content.html content=content lang=lang %}
23+
{% else %}
24+
{{ content }}
25+
{% endif %}
26+
{% endcapture %}
2727

2828
{% if page.layout == 'page' or page.collection == 'tabs' %}
2929
{% assign tab_key = page.title | downcase %}
@@ -55,14 +55,16 @@ <h1 class="dynamic-title">
5555
</div>
5656
</div>
5757

58-
<!-- tail -->
59-
{% if has_tail %}
60-
<div class="row">
61-
<div id="tail-wrapper" class="col-12 col-lg-11 col-xl-9 px-3 pe-xl-4 mt-5">
58+
<div class="row">
59+
<!-- tail -->
60+
<div id="tail-wrapper" class="col-12 col-lg-11 col-xl-9 px-md-4{% if has_tail%} mt-5{% endif %}">
61+
{% if has_tail %}
6262
{% for _include in layout.tail_includes %}
6363
{% assign _include_path = _include | append: '.html' %}
6464
{% include {{ _include_path }} lang=lang %}
6565
{% endfor %}
66-
</div>
66+
{% endif %}
67+
68+
{% include_cached footer.html lang=lang %}
6769
</div>
68-
{% endif %}
70+
</div>

_sass/addon/commons.scss

Lines changed: 19 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,11 @@ kbd {
175175
footer {
176176
font-size: 0.8rem;
177177
background-color: var(--main-bg);
178+
height: $footer-height;
179+
border-top: 1px solid var(--main-border-color);
178180

179181
@extend %text-color;
180182

181-
div.d-flex {
182-
height: $footer-height;
183-
line-height: 1.2rem;
184-
padding-bottom: 1rem;
185-
border-top: 1px solid var(--main-border-color);
186-
flex-wrap: wrap;
187-
}
188-
189183
a {
190184
@extend %text-highlight;
191185

@@ -195,7 +189,7 @@ footer {
195189
}
196190

197191
p {
198-
width: 100%;
192+
line-height: 1.75;
199193
text-align: center;
200194
margin-bottom: 0;
201195
}
@@ -1081,6 +1075,7 @@ $btn-mb: 0.5rem;
10811075

10821076
#core-wrapper {
10831077
line-height: 1.75;
1078+
min-height: calc(100vh - $topbar-height - $footer-height);
10841079

10851080
.categories,
10861081
#tags,
@@ -1108,7 +1103,6 @@ $btn-mb: 0.5rem;
11081103

11091104
#main-wrapper {
11101105
position: relative;
1111-
min-height: calc(100vh - $footer-height-mobile);
11121106

11131107
@include pl-pr(0);
11141108
}
@@ -1122,19 +1116,17 @@ $btn-mb: 0.5rem;
11221116
/* --- button back-to-top --- */
11231117

11241118
#back-to-top {
1125-
$size: 3rem;
1126-
11271119
display: none;
11281120
z-index: 1;
11291121
cursor: pointer;
11301122
position: fixed;
11311123
right: 1rem;
1132-
bottom: 2rem;
1124+
bottom: calc($footer-height-large - $back2top-size / 2);
11331125
background: var(--button-bg);
11341126
color: var(--btn-backtotop-color);
11351127
padding: 0;
1136-
width: $size;
1137-
height: $size;
1128+
width: $back2top-size;
1129+
height: $back2top-size;
11381130
border-radius: 50%;
11391131
border: 1px solid var(--btn-backtotop-border-color);
11401132
transition: transform 0.2s ease-out;
@@ -1146,7 +1138,7 @@ $btn-mb: 0.5rem;
11461138
}
11471139

11481140
i {
1149-
line-height: $size;
1141+
line-height: $back2top-size;
11501142
position: relative;
11511143
bottom: 2px;
11521144
}
@@ -1212,14 +1204,12 @@ $btn-mb: 0.5rem;
12121204
*/
12131205

12141206
@media all and (max-width: 576px) {
1215-
#main-wrapper {
1216-
min-height: calc(100vh - #{$footer-height-mobile});
1217-
}
1218-
12191207
#core-wrapper {
1208+
min-height: calc(100vh - $topbar-height - $footer-height-large);
1209+
12201210
.post-content {
12211211
> blockquote[class^='prompt-'] {
1222-
@include ml-mr(-1.25rem);
1212+
@include ml-mr(-1rem);
12231213

12241214
border-radius: 0;
12251215
max-width: none;
@@ -1260,30 +1250,19 @@ $btn-mb: 0.5rem;
12601250
}
12611251
}
12621252

1263-
html,
1264-
body {
1265-
overflow-x: hidden;
1266-
}
1267-
12681253
footer {
12691254
@include slide;
12701255

1271-
height: $footer-height-mobile;
1272-
1273-
div.d-flex {
1274-
padding: 1.5rem 0;
1275-
line-height: 1.65;
1276-
flex-wrap: wrap;
1277-
}
1256+
height: $footer-height-large;
1257+
padding: 1.5rem 0;
12781258
}
12791259

12801260
[#{$sidebar-display}] {
12811261
#sidebar {
12821262
transform: translateX(0);
12831263
}
12841264

1285-
#main-wrapper,
1286-
footer {
1265+
#main-wrapper {
12871266
transform: translateX(#{$sidebar-width});
12881267
}
12891268

@@ -1304,8 +1283,7 @@ $btn-mb: 0.5rem;
13041283
}
13051284

13061285
#topbar,
1307-
#main,
1308-
footer > .container {
1286+
#main {
13091287
max-width: 100%;
13101288
}
13111289

@@ -1352,40 +1330,15 @@ $btn-mb: 0.5rem;
13521330
}
13531331
} /* max-width: 849px */
13541332

1355-
/* Phone & Pad */
1356-
@media all and (min-width: 577px) and (max-width: 1199px) {
1357-
footer .d-flex > div {
1358-
width: 312px;
1359-
}
1360-
}
1361-
13621333
/* Sidebar is visible */
13631334
@media all and (min-width: 850px) {
13641335
/* Solved jumping scrollbar */
13651336
html {
13661337
overflow-y: scroll;
13671338
}
13681339

1369-
#main-wrapper,
1370-
footer {
1371-
margin-left: $sidebar-width;
1372-
}
1373-
13741340
#main-wrapper {
1375-
min-height: calc(100vh - $footer-height);
1376-
}
1377-
1378-
footer {
1379-
p {
1380-
width: auto;
1381-
&:last-child {
1382-
&::before {
1383-
content: '-';
1384-
margin: 0 0.75rem;
1385-
opacity: 0.8;
1386-
}
1387-
}
1388-
}
1341+
margin-left: $sidebar-width;
13891342
}
13901343

13911344
#sidebar {
@@ -1419,8 +1372,8 @@ $btn-mb: 0.5rem;
14191372

14201373
/* button 'back-to-Top' position */
14211374
#back-to-top {
1422-
bottom: 5.5rem;
14231375
right: 5%;
1376+
bottom: calc($footer-height - $back2top-size / 2);
14241377
}
14251378

14261379
#topbar-title {
@@ -1465,10 +1418,6 @@ $btn-mb: 0.5rem;
14651418
/* --- desktop mode, both sidebar and panel are visible --- */
14661419

14671420
@media all and (min-width: 1200px) {
1468-
#back-to-top {
1469-
bottom: 6.5rem;
1470-
}
1471-
14721421
#search-wrapper {
14731422
margin-right: 4rem;
14741423
}
@@ -1497,12 +1446,6 @@ $btn-mb: 0.5rem;
14971446
.post-content {
14981447
font-size: 1.03rem;
14991448
}
1500-
1501-
footer {
1502-
div.d-felx {
1503-
width: 85%;
1504-
}
1505-
}
15061449
}
15071450

15081451
@media all and (min-width: 1400px) {
@@ -1514,8 +1457,7 @@ $btn-mb: 0.5rem;
15141457
@media all and (min-width: 1650px) {
15151458
$icon-gap: 1rem;
15161459

1517-
#main-wrapper,
1518-
footer {
1460+
#main-wrapper {
15191461
margin-left: $sidebar-width-large;
15201462
}
15211463

@@ -1529,8 +1471,7 @@ $btn-mb: 0.5rem;
15291471
);
15301472
}
15311473

1532-
#main,
1533-
footer > .container {
1474+
#main {
15341475
max-width: $main-content-max-width;
15351476
padding-left: 1.75rem !important;
15361477
padding-right: 1.75rem !important;

_sass/addon/syntax.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ div[class^='language-'] {
150150
box-shadow: var(--language-border-color) 0 0 0 1px;
151151

152152
.post-content > & {
153-
@include ml-mr(-1.25rem);
153+
@include ml-mr(-1rem);
154154

155155
border-radius: 0;
156156
}

0 commit comments

Comments
 (0)