Skip to content

Commit

Permalink
Adds option to have multiple footer for different page types, merges …
Browse files Browse the repository at this point in the history
…footer of siate in one file
  • Loading branch information
1bl4z3r committed Jan 14, 2025
1 parent 08b8da3 commit eb40552
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 31 deletions.
2 changes: 1 addition & 1 deletion assets/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ table {

#site-footer {
text-align: center;
font-size: .9em;
font-size: .6em;
margin-bottom: 96px;
margin-top: 64px;

Expand Down
1 change: 0 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@
{{- partial "mermaid.html" . -}}
{{- if templates.Exists "partials/extra-foot.html" -}}{{- partial "extra-foot.html" . -}}{{- end }}
</body>

</html>
4 changes: 1 addition & 3 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,5 @@ <h2>{{- .Site.Params.pinned -}}</h2>
{{- end }}
</main>
{{ end }}

{{ define "footer" }}
{{ partialCached "footer.html" . }}
{{ define "footer" }}<footer id="site-footer" class="section-inner thin {{- if ne false .Site.Params.usesAnimation }} animated fadeIn faster {{- end -}}">{{- if templates.Exists "partials/list-footer.html" -}}{{- partialCached "list-footer.html" . -}}{{- else -}}{{- partial "footer.html" . -}}{{- end -}}</footer>
{{ end }}
3 changes: 1 addition & 2 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ <h1>{{ .Title }}</h1>
</main>
{{ end }}

{{ define "footer" }}
{{ partialCached "footer.html" . }}
{{ define "footer" }}<footer id="site-footer" class="section-inner thin {{- if ne false .Site.Params.usesAnimation }} animated fadeIn faster {{- end -}}">{{- if templates.Exists "partials/single-footer.html" -}}{{- partialCached "single-footer.html" . -}}{{- else -}}{{- partial "footer.html" . -}}{{- end -}}</footer>
{{ end }}
4 changes: 2 additions & 2 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ <h1 id="home-title">{{ .Site.Title }}</h1>
{{ partialCached "menu.html" . }}
</nav>
</div>
<div id="home-footer">{{ partialCached "single-footer.html" . }}</div>
<div id="home-footer">{{- if templates.Exists "partials/index-footer.html" -}}{{- partialCached "index-footer.html" . -}}{{- else -}}{{- partial "footer.html" . -}}{{- end -}}</div>
</div>
{{ end }}
{{ end }}
31 changes: 17 additions & 14 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<footer id="site-footer" class="section-inner thin {{- if ne false .Site.Params.usesAnimation }} animated fadeIn faster {{- end -}}">
<p>
&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
&#183; {{ .Site.Params.footerCopyright | safeHTML }}
{{- if not .Site.Params.footerHideThemeName -}}
&#183; Made with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a>
&#183; Theme <a href="https://github.com/1bl4z3r/hermit-V2" target="_blank" rel="noopener">Hermit-V2</a>
{{- end -}}
{{- with .OutputFormats.Get "RSS" }}
&#183; <a href="{{ "posts/index.xml" | absLangURL }}" target="_blank" title="rss">{{- partial "svg.html" (dict "context" . "name" "rss") -}}</a>
{{- end -}}
</p>

</footer>
{{/*
This partial is responsible for footer contents for the site
You can make page specific footers by creating below partials in `/layouts/partials`
For homepage (or landing page), index-footer.html
For article list pages, list-footer.html
For single pages (which are not articles), single-footer.html
For posts/articles pages, posts-footer.html
*/}}
<p>
&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
&#183; {{ .Site.Params.footerCopyright | safeHTML }}
{{- if not .Site.Params.footerHideThemeName -}}
&#183; Made with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a>
&#183; Theme <a href="https://github.com/1bl4z3r/hermit-V2" target="_blank" rel="noopener">Hermit-V2</a>
{{- end -}}
{{- with .OutputFormats.Get "RSS" }}&#183; <a href="{{ "posts/index.xml" | absLangURL }}" target="_blank" title="rss">{{- partial "svg.html" (dict "context" . "name" "rss") -}}</a>{{- end -}}
</p>
6 changes: 0 additions & 6 deletions layouts/partials/single-footer.html

This file was deleted.

3 changes: 1 addition & 2 deletions layouts/posts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,5 @@ <h1>{{ .Title }}</h1>
</main>
{{ end }}

{{ define "footer" }}
{{ partialCached "footer.html" . }}
{{ define "footer" }}<footer id="site-footer" class="section-inner thin {{- if ne false .Site.Params.usesAnimation }} animated fadeIn faster {{- end -}}">{{- if templates.Exists "partials/posts-footer.html" -}}{{- partialCached "posts-footer.html" . -}}{{- else -}}{{- partial "footer.html" . -}}{{- end -}}</footer>
{{ end }}

0 comments on commit eb40552

Please sign in to comment.