feat: add detection of the theme version and Hugo version (#173)

* feat: add detection of the theme version and Hugo version

* fix: hugo.IsProduction is incompatible in Hugo v0.62.0
This commit is contained in:
Dillon
2020-03-16 21:35:16 +08:00
committed by GitHub
parent 9a7189c2a3
commit 41c2d3a38e
20 changed files with 53 additions and 26 deletions

View File

@@ -243,6 +243,6 @@
{{- end -}}
{{- /* Google analytics async */ -}}
{{- if $scratch.Get "production" | and .Site.GoogleAnalytics -}}
{{- if eq hugo.Environment "production" | and .Site.GoogleAnalytics -}}
{{- template "_internal/google_analytics_async.html" . -}}
{{- end -}}

View File

@@ -1,6 +1,6 @@
{{- $scratch := .Scratch.Get "scratch" -}}
{{- if $scratch.Get "production" | and (ne .Site.Params.comment.enable false) | and (ne .Params.comment false) -}}
{{- if eq hugo.Environment "production" | and (ne .Site.Params.comment.enable false) | and (ne .Params.comment false) -}}
{{- $CDN := $scratch.Get "CDN" -}}
{{- /* Disqus Comment System */ -}}

View File

@@ -1,8 +1,11 @@
{{- $scratch := .Scratch.Get "scratch" -}}
<footer class="footer">
<div class="copyright">
{{- /* Hugo and LoveIt */ -}}
<div class="copyright-line">
{{- printf (T "poweredBySome") `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreffer">Hugo</a>` | safeHTML }} | {{ T "theme" }} - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="external nofollow noopener noreffer"><i class="far fa-heart fa-fw"></i> LoveIt</a>
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo %s">Hugo</a>` hugo.Version -}}
{{- printf (T "poweredBySome") $hugo | safeHTML }} | {{ T "theme" }} - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt v{{ $scratch.Get "version" }}"><i class="far fa-heart fa-fw"></i> LoveIt</a>
</div>
<div class="copyright-line">

View File

@@ -1,5 +1,6 @@
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
{{- hugo.Generator -}}
<meta name="theme-color" content="#ffffff">
<meta name="msapplication-TileColor" content="#da532c">