diff options
Diffstat (limited to 'layouts/partials')
-rw-r--r-- | layouts/partials/comment-disqus.html | 18 | ||||
-rw-r--r-- | layouts/partials/scripts-end.html | 16 |
2 files changed, 34 insertions, 0 deletions
diff --git a/layouts/partials/comment-disqus.html b/layouts/partials/comment-disqus.html new file mode 100644 index 0000000..539f8c7 --- /dev/null +++ b/layouts/partials/comment-disqus.html @@ -0,0 +1,18 @@ +{{ with .Site.Params.disqusShortname }} +<div class="post-comment"> + <div id="disqus_thread"></div> + <script> + var disqus_config = function () { + this.page.url = "{{ $.Permalink }}"; + this.page.identifier = "{{ $.RelPermalink }}"; + }; + (function () { + var d = document, + s = d.createElement('script'); + s.src = 'https://{{ . }}.disqus.com/embed.js'; + s.setAttribute('data-timestamp', +new Date()); + (d.head || d.body).appendChild(s); + })(); + </script> +</div> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/scripts-end.html b/layouts/partials/scripts-end.html index ea37e5c..39b3a00 100644 --- a/layouts/partials/scripts-end.html +++ b/layouts/partials/scripts-end.html @@ -118,6 +118,22 @@ } }); </script> +{{ else if and (and (ne .Params.noComments true) (.IsPage)) (.Site.Params.disqusShortname) }} +<script> + // theme switch button + $('.btn .btn-toggle-mode').on('click', () => { + // toggle theme + toggleTheme(); + // update medium background + updateMeidumTheme($('body').attr('data-theme'), mediumEvent); + // update disqus theme if available + if (DISQUS) { + DISQUS.reset({ + reload: true + }); + } + }); +</script> {{ else }} <script> // theme switch button |