diff options
author | yyBeta <up9288yy@gmail.com> | 2017-04-26 14:58:48 +0300 |
---|---|---|
committer | coderzh <pythonzh@qq.com> | 2017-05-07 13:22:08 +0300 |
commit | 8a8c4a79065cfa9ecf1f5427ba06e49bcc7105df (patch) | |
tree | 41298f9bb69971ee943ec51ac3f8467ba6709b4b | |
parent | 65044685b88e732a9837e9591fd2e2f726a0955f (diff) |
fix 'isset not supported for some params' problem under new version hugo
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | exampleSite/config.toml | 12 | ||||
-rw-r--r-- | layouts/partials/comment.html | 8 | ||||
-rw-r--r-- | layouts/partials/google_analytics.html | 4 |
4 files changed, 12 insertions, 24 deletions
@@ -33,15 +33,9 @@ RSSUri = "feed.xml" DateFormat = "2006年01月02日" MonthFormat = "2006年01月" FancyBox = true - - #[Params.DuoShuo] - # ShortName = "coderzh" - - [Params.Disqus] - ShortName = "coderzh" - - [Params.GoogleAnalytics] - ID = "UA-10147768-2" + # DuoShuoShortName = "coderzh" + DisqusShortName = "coderzh" + GoogleAnalyticsID = "UA-10147768-2" [Params.Strings] Search = "搜索" diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 4c99dd2..81529e4 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -26,15 +26,9 @@ RSSUri = "feed.xml" DateFormat = "2006年01月02日" MonthFormat = "2006年01月" FancyBox = true - - #[Params.DuoShuo] - # ShortName = "coderzh" - - [Params.Disqus] - ShortName = "coderzh" - - [Params.GoogleAnalytics] - ID = "UA-10147768-2" + # DuoShuoShortName = "coderzh" + DisqusShortName = "coderzh" + GoogleAnalyticsID = "UA-10147768-2" [Params.Strings] Search = "搜索" diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index 4e2fe5e..8583518 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -1,10 +1,10 @@ -{{ if isset .Site.Params "DuoShuo" }} +{{ if .Site.Params.DuoShuoShortName }} <section class="comment"> <div class="ds-thread" data-thread-key="{{ .Permalink }}" data-title="{{ .Title }}" data-url="{{ .Permalink }}"></div> </section> <script type="text/javascript"> -var duoshuoQuery = {short_name:"{{ .Site.Params.DuoShuo.ShortName }}"}; +var duoshuoQuery = {short_name:"{{ .Site.Params.DuoShuoShortName }}"}; (function() { var ds = document.createElement('script'); ds.type = 'text/javascript';ds.async = true; @@ -16,7 +16,7 @@ var duoshuoQuery = {short_name:"{{ .Site.Params.DuoShuo.ShortName }}"}; </script> {{ end }} -{{ if isset .Site.Params "Disqus"}} +{{ if .Site.Params.DisqusShortName }} <section class="comment"> <div id="disqus_thread"></div> </section> @@ -32,7 +32,7 @@ this.page.identifier = {{ .Permalink }}; (function() { // DON'T EDIT BELOW THIS LINE var d = document, s = d.createElement('script'); -s.src = '//{{ .Site.Params.Disqus.ShortName }}.disqus.com/embed.js'; +s.src = '//{{ .Site.Params.DisqusShortName }}.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); diff --git a/layouts/partials/google_analytics.html b/layouts/partials/google_analytics.html index 61ebe4e..8b937ce 100644 --- a/layouts/partials/google_analytics.html +++ b/layouts/partials/google_analytics.html @@ -1,10 +1,10 @@ -{{ if isset .Site.Params "GoogleAnalytics"}} +{{ if .Site.Params.GoogleAnalyticsID }} <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - ga('create', '{{ .Site.Params.GoogleAnalytics.ID }}', 'auto'); + ga('create', '{{ .Site.Params.GoogleAnalyticsID }}', 'auto'); ga('send', 'pageview'); $('#messagesbsb').remove(); </script> |