mirror of
https://github.com/fruworg/themu.git
synced 2024-11-16 07:07:16 +03:00
Add disqus comment (#79)
* add disqus * Add readme --------- Co-authored-by: adibaulia <adib.aulia@gli.id>
This commit is contained in:
parent
3fa25abce4
commit
d717302b01
@ -17,6 +17,7 @@ Forked from [Ezhil Theme](https://github.com/vividvilla/ezhil)
|
|||||||
- Dark/Light Mode toggle
|
- Dark/Light Mode toggle
|
||||||
- tl:dr; frontamatter
|
- tl:dr; frontamatter
|
||||||
- Cache busting for CSS files
|
- Cache busting for CSS files
|
||||||
|
- Disqus Comments
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
In your Hugo website directory, create a new folder named theme and clone the repo
|
In your Hugo website directory, create a new folder named theme and clone the repo
|
||||||
@ -73,6 +74,8 @@ pygmentsstyle = "monokai"
|
|||||||
pygmentscodefences = true
|
pygmentscodefences = true
|
||||||
pygmentscodefencesguesssyntax = true
|
pygmentscodefencesguesssyntax = true
|
||||||
|
|
||||||
|
disqusShortname = "yourDisqusShortname"
|
||||||
|
|
||||||
paginate=3 # articles per page
|
paginate=3 # articles per page
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
@ -28,6 +28,15 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
{{- $.Scratch.Set "isDisqus" true -}}
|
||||||
|
<!-- Check if disqus short name is given -->
|
||||||
|
{{ if not .Site.DisqusShortname }}
|
||||||
|
{{- $.Scratch.Set "isDisqus" false -}}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{- if eq ($.Scratch.Get "isDisqus") true -}}
|
||||||
|
{{- partial "disqus.html" . -}}
|
||||||
|
{{- end -}}
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
19
layouts/partials/disqus.html
Normal file
19
layouts/partials/disqus.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<div id="disqus_thread"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function () {
|
||||||
|
// Don't ever inject Disqus on localhost--it creates unwanted
|
||||||
|
// discussions from 'localhost:1313' on your Disqus account...
|
||||||
|
if (window.location.hostname == "localhost")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var dsq = document.createElement('script');
|
||||||
|
dsq.type = 'text/javascript';
|
||||||
|
dsq.async = true;
|
||||||
|
var disqus_shortname = '{{ .Site.DisqusShortname }}';
|
||||||
|
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||||||
|
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by
|
||||||
|
Disqus.</a></noscript>
|
||||||
|
<a href="http://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
Loading…
Reference in New Issue
Block a user