Allow to disable the footer with params.footer.enable = false
Default is to have the footer enabled (to keep backwards compatibility). The diff looks much worse than it is, I just added a variable and an if clause, but then had to indent the rest of the file. Make footerEnabled an explicit variable. This should improve readability. Use default parameter for even more readability.
This commit is contained in:
parent
78ea0674dd
commit
674156343d
1 changed files with 106 additions and 102 deletions
|
@ -1,112 +1,116 @@
|
||||||
{{ $author:= site.Data.author }}
|
{{ $footerEnabled := site.Params.footer.enable | default true }}
|
||||||
{{ if (index site.Data site.Language.Lang).author }}
|
|
||||||
{{ $author = (index site.Data site.Language.Lang).author }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ $sections:= site.Data.sections }}
|
{{ if $footerEnabled }}
|
||||||
{{ if (index site.Data site.Language.Lang).sections }}
|
{{ $author:= site.Data.author }}
|
||||||
{{ $sections = (index site.Data site.Language.Lang).sections }}
|
{{ if (index site.Data site.Language.Lang).author }}
|
||||||
{{ end }}
|
{{ $author = (index site.Data site.Language.Lang).author }}
|
||||||
|
|
||||||
{{ $copyrightNotice := "© 2020 Copyright."}}
|
|
||||||
{{ if (index site.Data site.Language.Lang).site }}
|
|
||||||
{{ $siteConfig := (index site.Data site.Language.Lang).site }}
|
|
||||||
{{ if $siteConfig.copyright }}
|
|
||||||
{{ $copyrightNotice = $siteConfig.copyright }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{/* footer logos */}}
|
{{ $sections:= site.Data.sections }}
|
||||||
{{ $themeLogo := "/images/theme-logo.png" }}
|
{{ if (index site.Data site.Language.Lang).sections }}
|
||||||
{{ $hugoLogo := "/images/hugo-logo.svg" }}
|
{{ $sections = (index site.Data site.Language.Lang).sections }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{/* resize the logos. don't resize svg because it is not supported */}}
|
{{ $copyrightNotice := "© 2020 Copyright."}}
|
||||||
{{ $themeLogo:= resources.Get $themeLogo}}
|
{{ if (index site.Data site.Language.Lang).site }}
|
||||||
{{ if and $themeLogo (ne $themeLogo.MediaType.SubType "svg") }}
|
{{ $siteConfig := (index site.Data site.Language.Lang).site }}
|
||||||
{{ $themeLogo = $themeLogo.Resize "32x" }}
|
{{ if $siteConfig.copyright }}
|
||||||
{{ end }}
|
{{ $copyrightNotice = $siteConfig.copyright }}
|
||||||
{{ $themeLogo = $themeLogo.RelPermalink}}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ $hugoLogo:= resources.Get $hugoLogo}}
|
{{/* footer logos */}}
|
||||||
{{ if and $hugoLogo (ne $hugoLogo.MediaType.SubType "svg")}}
|
{{ $themeLogo := "/images/theme-logo.png" }}
|
||||||
{{ $hugoLogo = $hugoLogo.Resize "32x" }}
|
{{ $hugoLogo := "/images/hugo-logo.svg" }}
|
||||||
{{ end }}
|
|
||||||
{{ $hugoLogo = $hugoLogo.RelPermalink}}
|
|
||||||
|
|
||||||
<footer class="container-fluid text-center align-content-center footer pb-2">
|
{{/* resize the logos. don't resize svg because it is not supported */}}
|
||||||
<div class="container pt-5">
|
{{ $themeLogo:= resources.Get $themeLogo}}
|
||||||
<div class="row text-left">
|
{{ if and $themeLogo (ne $themeLogo.MediaType.SubType "svg") }}
|
||||||
<div class="col-md-4 col-sm-12">
|
{{ $themeLogo = $themeLogo.Resize "32x" }}
|
||||||
<h5>{{ i18n "navigation" }}</h5>
|
{{ end }}
|
||||||
{{ if $sections }}
|
{{ $themeLogo = $themeLogo.RelPermalink}}
|
||||||
<ul>
|
|
||||||
{{- range sort $sections "section.weight" }}
|
{{ $hugoLogo:= resources.Get $hugoLogo}}
|
||||||
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
{{ if and $hugoLogo (ne $hugoLogo.MediaType.SubType "svg")}}
|
||||||
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
{{ $hugoLogo = $hugoLogo.Resize "32x" }}
|
||||||
{{ if .section.id }}
|
{{ end }}
|
||||||
{{ $sectionID = .section.id }}
|
{{ $hugoLogo = $hugoLogo.RelPermalink}}
|
||||||
|
|
||||||
|
<footer class="container-fluid text-center align-content-center footer pb-2">
|
||||||
|
<div class="container pt-5">
|
||||||
|
<div class="row text-left">
|
||||||
|
<div class="col-md-4 col-sm-12">
|
||||||
|
<h5>{{ i18n "navigation" }}</h5>
|
||||||
|
{{ if $sections }}
|
||||||
|
<ul>
|
||||||
|
{{- range sort $sections "section.weight" }}
|
||||||
|
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
||||||
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
|
{{ if .section.id }}
|
||||||
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="smooth-scroll" href="/#{{ $sectionID }}">{{ .section.name }}</a>
|
||||||
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<li class="nav-item">
|
{{- end }}
|
||||||
<a class="smooth-scroll" href="/#{{ $sectionID }}">{{ .section.name }}</a>
|
</ul>
|
||||||
</li>
|
|
||||||
{{ end }}
|
|
||||||
{{- end }}
|
|
||||||
</ul>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{{ if $author }}
|
|
||||||
<div class="col-md-4 col-sm-12">
|
|
||||||
<h5>{{ i18n "contact_me" }}</h5>
|
|
||||||
<ul>
|
|
||||||
{{ range $key,$value:= $author.contactInfo }}
|
|
||||||
<li><span>{{ title $key }}: </span> <span>{{ $value }}</span></li>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ if $author }}
|
||||||
{{ if site.Params.newsletter.enable }}
|
<div class="col-md-4 col-sm-12">
|
||||||
<div class="col-md-4 col-sm-12">
|
<h5>{{ i18n "contact_me" }}</h5>
|
||||||
<!-- <h5>Newsletter</h5> -->
|
<ul>
|
||||||
<p>{{ i18n "newsletter_text" }}</p>
|
{{ range $key,$value:= $author.contactInfo }}
|
||||||
<form>
|
<li><span>{{ title $key }}: </span> <span>{{ $value }}</span></li>
|
||||||
<div class="form-group">
|
{{ end }}
|
||||||
<input
|
</ul>
|
||||||
type="email"
|
</div>
|
||||||
class="form-control"
|
{{ end }}
|
||||||
id="exampleInputEmail1"
|
{{ if site.Params.newsletter.enable }}
|
||||||
aria-describedby="emailHelp"
|
<div class="col-md-4 col-sm-12">
|
||||||
placeholder="{{ i18n "newsletter_input_placeholder" }}"
|
<!-- <h5>Newsletter</h5> -->
|
||||||
/>
|
<p>{{ i18n "newsletter_text" }}</p>
|
||||||
<small id="emailHelp" class="form-text text-muted"
|
<form>
|
||||||
>{{ i18n "newsletter_warning" }}</small
|
<div class="form-group">
|
||||||
>
|
<input
|
||||||
</div>
|
type="email"
|
||||||
<button type="submit" class="btn btn-info">{{ i18n "submit" }}</button>
|
class="form-control"
|
||||||
</form>
|
id="exampleInputEmail1"
|
||||||
</div>
|
aria-describedby="emailHelp"
|
||||||
{{ end }}
|
placeholder="{{ i18n "newsletter_input_placeholder" }}"
|
||||||
</div>
|
/>
|
||||||
</div>
|
<small id="emailHelp" class="form-text text-muted"
|
||||||
<hr />
|
>{{ i18n "newsletter_warning" }}</small
|
||||||
<div class="container">
|
>
|
||||||
<div class="row text-left">
|
</div>
|
||||||
<div class="col-md-4">
|
<button type="submit" class="btn btn-info">{{ i18n "submit" }}</button>
|
||||||
<a id="theme" href="https://github.com/hossainemruz/toha" target="_blank" rel="noopener">
|
</form>
|
||||||
<img src="{{ $themeLogo }}" alt="Toha Theme Logo">
|
</div>
|
||||||
Toha
|
{{ end }}
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 text-center">{{ $copyrightNotice | markdownify }}</div>
|
|
||||||
<div class="col-md-4 text-right">
|
|
||||||
<a id="hugo" href="https://gohugo.io/" target="_blank" rel="noopener">{{ i18n "hugoAttributionText" }}
|
|
||||||
<img
|
|
||||||
src="{{ $hugoLogo }}"
|
|
||||||
alt="Hugo Logo"
|
|
||||||
height="18"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<hr />
|
||||||
</footer>
|
<div class="container">
|
||||||
|
<div class="row text-left">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<a id="theme" href="https://github.com/hossainemruz/toha" target="_blank" rel="noopener">
|
||||||
|
<img src="{{ $themeLogo }}" alt="Toha Theme Logo">
|
||||||
|
Toha
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 text-center">{{ $copyrightNotice | markdownify }}</div>
|
||||||
|
<div class="col-md-4 text-right">
|
||||||
|
<a id="hugo" href="https://gohugo.io/" target="_blank" rel="noopener">{{ i18n "hugoAttributionText" }}
|
||||||
|
<img
|
||||||
|
src="{{ $hugoLogo }}"
|
||||||
|
alt="Hugo Logo"
|
||||||
|
height="18"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
{{end}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue