Skip to content

Commit 4233cc7

Browse files
layouts: split footer partial in several partials
This allows to more easily override some parts of the footer. Signed-off-by: Yann Soubeyrand <[email protected]>
1 parent 18af2d5 commit 4233cc7

File tree

5 files changed

+34
-35
lines changed

5 files changed

+34
-35
lines changed

layouts/partials/footer.html

+4-35
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,15 @@
1-
{{ $links := .Site.Params.links -}}
21
<footer class="td-footer row d-print-none">
32
<div class="container-fluid">
43
<div class="row mx-md-2">
5-
<div class="col-6 col-sm-4 text-xs-center order-sm-2">
6-
{{ with $links }}
7-
{{ with index . "user" }}
8-
{{ template "footer-links-block" . }}
9-
{{ end }}
10-
{{ end }}
4+
<div class="col-6 col-sm-4 text-xs-center order-sm-1">
5+
{{ partial "footer/left.html" . }}
116
</div>
127
<div class="col-6 col-sm-4 text-end text-xs-center order-sm-3">
13-
{{ with $links }}
14-
{{ with index . "developer" }}
15-
{{ template "footer-links-block" . }}
16-
{{ end }}
17-
{{ end }}
8+
{{ partial "footer/right.html" . }}
189
</div>
1910
<div class="td-footer__copyright-etc col-12 col-sm-4 text-center py-2 order-sm-2">
20-
{{ with .Site.Params.copyright -}}
21-
<span>&copy; {{ now.Year }} {{ . }} {{ T "footer_all_rights_reserved" }}</span>
22-
{{- end }}
23-
{{ with .Site.Params.privacy_policy -}}
24-
<span class="ms-1"><a href="{{ . }}" target="_blank" rel="noopener">{{ T "footer_privacy_policy" }}</a></span>
25-
{{- end }}
26-
{{ if not .Site.Params.ui.footer_about_disable -}}
27-
{{ with .Site.GetPage "about" -}}
28-
<p class="td-footer__about mt-2"><a href="{{ .RelPermalink }}">{{ .Title }}</a></p>
29-
{{- end -}}
30-
{{ end }}
11+
{{ partial "footer/center.html" . }}
3112
</div>
3213
</div>
3314
</div>
3415
</footer>
35-
36-
{{- define "footer-links-block" }}
37-
<ul class="td-footer__links-list">
38-
{{ range . }}
39-
<li class="td-footer__links-item" data-bs-toggle="tooltip" title="{{ .name }}" aria-label="{{ .name }}">
40-
<a target="_blank" rel="noopener" href="{{ .url }}" aria-label="{{ .name }}">
41-
<i class="{{ .icon }}"></i>
42-
</a>
43-
</li>
44-
{{ end }}
45-
</ul>
46-
{{ end -}}

layouts/partials/footer/center.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{ with .Site.Params.copyright -}}
2+
<span>&copy; {{ now.Year }} {{ . }} {{ T "footer_all_rights_reserved" }}</span>
3+
{{- end }}
4+
{{ with .Site.Params.privacy_policy -}}
5+
<span class="ms-1"><a href="{{ . }}" target="_blank" rel="noopener">{{ T "footer_privacy_policy" }}</a></span>
6+
{{- end }}
7+
{{ if not .Site.Params.ui.footer_about_disable -}}
8+
{{ with .Site.GetPage "about" -}}
9+
<p class="td-footer__about mt-2"><a href="{{ .RelPermalink }}">{{ .Title }}</a></p>
10+
{{- end -}}
11+
{{ end }}

layouts/partials/footer/left.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ with .Site.Params.links }}
2+
{{ with index . "user" }}
3+
{{ partial "footer/links.html" . }}
4+
{{ end }}
5+
{{ end }}

layouts/partials/footer/links.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ul class="td-footer__links-list">
2+
{{ range . }}
3+
<li class="td-footer__links-item" data-bs-toggle="tooltip" title="{{ .name }}" aria-label="{{ .name }}">
4+
<a target="_blank" rel="noopener" href="{{ .url }}" aria-label="{{ .name }}">
5+
<i class="{{ .icon }}"></i>
6+
</a>
7+
</li>
8+
{{ end }}
9+
</ul>

layouts/partials/footer/right.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ with .Site.Params.links }}
2+
{{ with index . "developer" }}
3+
{{ partial "footer/links.html" . }}
4+
{{ end }}
5+
{{ end }}

0 commit comments

Comments
 (0)