1
0
Эх сурвалжийг харах

feature to fix issue #288 (#289)

* fix for issue #288

* refactor some conditionnal statements

* adding hideFooter parameter to exampleSite config
Clément Pannetier 5 жил өмнө
parent
commit
5a10cb7e6c

+ 1 - 0
exampleSite/config.toml

@@ -26,6 +26,7 @@ disqusShortname = "yourdiscussshortname"
 
     dateformat = "January 2, 2006"
 
+    hideFooter = false
     hideCredits = false
     hideCopyright = false
     since = 2019

+ 24 - 22
layouts/partials/footer.html

@@ -1,24 +1,26 @@
-<footer class="footer">
-  <section class="container">
-    {{ with .Site.Params.footercontent | safeHTML }}
-      <p>{{.}}</p>
-    {{ end }}
-    {{ if not .Site.Params.hideCopyright }}
-      {{ with .Site.Params.since }}
-        © {{ if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year }}
-      {{ else }}
-        © {{ now.Year }}
+{{ if not .Site.Params.hideFooter | default false }}
+  <footer class="footer">
+    <section class="container">
+      {{ with .Site.Params.footercontent | safeHTML }}
+        <p>{{ . }}</p>
       {{ end }}
-      {{ if .Site.Params.Author }} {{ .Site.Params.Author }} {{ end }}
-    {{ end }}
-    {{ if not .Site.Params.hideCredits }}
-      {{ if not .Site.Params.hideCopyright }} · {{ end }}
-      {{ i18n "powered_by" }} <a href="https://gohugo.io/">Hugo</a> & <a href="https://github.com/luizdepra/hugo-coder/">Coder</a>.
-    {{ end }}
-    {{ if .Site.Params.commit }}
-      {{ if .GitInfo }}
-        [<a href="{{ .Site.Params.commit }}/{{ .GitInfo.Hash }}">{{ .GitInfo.AbbreviatedHash }}</a>]
+      {{ if not .Site.Params.hideCopyright }}
+        ©
+        {{ if (and (.Site.Params.since) (lt .Site.Params.since now.Year)) }}
+          {{ .Site.Params.since }} -
+        {{ end }}
+        {{ now.Year }}
+        {{ with .Site.Params.Author }} {{ . }} {{ end }}
       {{ end }}
-    {{ end }}
-  </section>
-</footer>
+      {{ if not .Site.Params.hideCredits }}
+        {{ if not .Site.Params.hideCopyright }} · {{ end }}
+        {{ i18n "powered_by" }} <a href="https://gohugo.io/">Hugo</a> & <a href="https://github.com/luizdepra/hugo-coder/">Coder</a>.
+      {{ end }}
+      {{ if .Site.Params.commit }}
+        {{ if .GitInfo }}
+          [<a href="{{ .Site.Params.commit }}/{{ .GitInfo.Hash }}">{{ .GitInfo.AbbreviatedHash }}</a>]
+        {{ end }}
+      {{ end }}
+    </section>
+  </footer>
+{{ end }}