Pārlūkot izejas kodu

Adding the ability to have git commit hash in the footer (#78)

* Adding the ability to have git commit hash in the footer

* making changes as discussed in GH-78

* last changes before merge

* removed lines that are not needed

* fixing duplicate

* Last changes hopefully
Dale Noe 7 gadi atpakaļ
vecāks
revīzija
2a9b72d2ac
2 mainītis faili ar 12 papildinājumiem un 1 dzēšanām
  1. 3 0
      exampleSite/config.toml
  2. 9 1
      layouts/partials/footer.html

+ 3 - 0
exampleSite/config.toml

@@ -27,6 +27,9 @@ disqusShortname = "yourdiscussshortname"
     hideCredits = false
     hideCopyright = false
 
+    # Git Commit in Footer, uncomment the line below to enable it.
+    commit = "https://github.com/luizdepra/hugo-coder/tree/"
+
     rtl = false
 
     # Custom CSS

+ 9 - 1
layouts/partials/footer.html

@@ -3,6 +3,14 @@
     {{ with .Site.Params.footercontent }}
       <p>{{.}}</p>
     {{ end }}
-    {{ if not .Site.Params.hideCopyright }} © {{ .Site.LastChange.Format "2006" }} {{ end }} {{ if not .Site.Params.hideCredits}} {{ if not .Site.Params.hideCopyright }} · {{ end }} Powered by <a href="https://gohugo.io/">Hugo</a> & <a href="https://github.com/luizdepra/hugo-coder/">Coder</a>. {{ end }}
+    {{ if not .Site.Params.hideCopyright }} © {{ .Site.LastChange.Format "2006" }}{{ end }}
+    {{ if not .Site.Params.hideCredits }}
+      {{ if not .Site.Params.hideCopyright }} · {{ end }}
+      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 or (not .Site.Params.hideCredits) (not .Site.Params.hideCopyright) }} · {{ end }}
+      [<a href="{{ .Site.Params.commit }}{{ getenv "GIT_COMMIT_SHA" }}">{{ getenv "GIT_COMMIT_SHA_SHORT" }}</a>]
+    {{ end }}
   </section>
 </footer>