Skip to content

Commit

Permalink
layouts: split footer partial in several partials
Browse files Browse the repository at this point in the history
This allows to more easily override some parts of the footer.

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@gmx.fr>
  • Loading branch information
yann-soubeyrand committed May 31, 2023
1 parent 00b97f4 commit 1f6fc75
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 29 deletions.
33 changes: 4 additions & 29 deletions layouts/partials/footer.html
@@ -1,40 +1,15 @@
{{ $links := .Site.Params.links -}}
<footer class="bg-dark pt-5 row d-print-none">
<div class="container-fluid">
<div class="row mx-md-2">
<div class="col-6 col-sm-4 text-xs-center order-sm-2">
{{ with $links }}
{{ with index . "user" }}
{{ template "footer-links-block" . }}
{{ end }}
{{ end }}
<div class="col-6 col-sm-4 text-xs-center order-sm-1">
{{ partial "footer/left.html" . }}
</div>
<div class="col-6 col-sm-4 text-end text-xs-center order-sm-3">
{{ with $links }}
{{ with index . "developer" }}
{{ template "footer-links-block" . }}
{{ end }}
{{ end }}
{{ partial "footer/right.html" . }}
</div>
<div class="col-12 col-sm-4 text-center py-2 order-sm-2">
{{ with .Site.Params.copyright }}<small class="text-white">&copy; {{ now.Year}} {{ .}} {{ T "footer_all_rights_reserved" }}</small>{{ end }}
{{ with .Site.Params.privacy_policy }}<small class="ms-1"><a href="{{ . }}" target="_blank" rel="noopener">{{ T "footer_privacy_policy" }}</a></small>{{ end }}
{{ if not .Site.Params.ui.footer_about_disable -}}
{{ with .Site.GetPage "about" }}<p class="mt-2"><a href="{{ .RelPermalink }}">{{ .Title }}</a></p>{{ end }}
{{ end }}
{{ partial "footer/center.html" . }}
</div>
</div>
</div>
</footer>

{{- define "footer-links-block" }}
<ul class="list-inline mb-0">
{{ range . }}
<li class="list-inline-item h3" data-bs-toggle="tooltip" title="{{ .name }}" aria-label="{{ .name }}">
<a class="text-white" target="_blank" rel="noopener" href="{{ .url }}" aria-label="{{ .name }}">
<i class="{{ .icon }}"></i>
</a>
</li>
{{ end }}
</ul>
{{ end -}}
5 changes: 5 additions & 0 deletions layouts/partials/footer/center.html
@@ -0,0 +1,5 @@
{{ with .Site.Params.copyright }}<small class="text-white">&copy; {{ now.Year }} {{ . }} {{ T "footer_all_rights_reserved" }}</small>{{ end }}
{{ with .Site.Params.privacy_policy }}<small class="ms-1"><a href="{{ . }}" target="_blank" rel="noopener">{{ T "footer_privacy_policy" }}</a></small>{{ end }}
{{ if not .Site.Params.ui.footer_about_disable -}}
{{ with .Site.GetPage "about" }}<p class="mt-2"><a href="{{ .RelPermalink }}">{{ .Title }}</a></p>{{ end }}
{{ end }}
5 changes: 5 additions & 0 deletions layouts/partials/footer/left.html
@@ -0,0 +1,5 @@
{{ with .Site.Params.links }}
{{ with index . "user" }}
{{ partial "footer/links.html" . }}
{{ end }}
{{ end }}
9 changes: 9 additions & 0 deletions layouts/partials/footer/links.html
@@ -0,0 +1,9 @@
<ul class="list-inline mb-0">
{{ range . }}
<li class="list-inline-item h3" data-bs-toggle="tooltip" title="{{ .name }}" aria-label="{{ .name }}">
<a class="text-white" target="_blank" rel="noopener" href="{{ .url }}" aria-label="{{ .name }}">
<i class="{{ .icon }}"></i>
</a>
</li>
{{ end }}
</ul>
5 changes: 5 additions & 0 deletions layouts/partials/footer/right.html
@@ -0,0 +1,5 @@
{{ with .Site.Params.links }}
{{ with index . "developer" }}
{{ partial "footer/links.html" . }}
{{ end }}
{{ end }}

0 comments on commit 1f6fc75

Please sign in to comment.