Add disqus comments
This commit is contained in:
parent
67ba008385
commit
58913dcd56
|
@ -430,6 +430,23 @@ caption {
|
|||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
/* Disqus Comments */
|
||||
#disqus-container {
|
||||
font-size: 0.85rem;
|
||||
border: 1px solid;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
#disqus-button {
|
||||
width: 100%;
|
||||
}
|
||||
#disqus-comments {
|
||||
display: none;
|
||||
}
|
||||
#disqus-comments,
|
||||
#disqus-comments iframe {
|
||||
max-height: 75vh !important;
|
||||
}
|
||||
|
||||
/* Pattern lists */
|
||||
.patterns-list {
|
||||
list-style: none;
|
||||
|
|
|
@ -4,6 +4,7 @@ defaultContentLanguage = "en"
|
|||
title = "Cupper"
|
||||
theme = "cupper-hugo-theme"
|
||||
googleAnalytics = "UA-123456789-1"
|
||||
disqusShortname = "yourdiscussshortname"
|
||||
|
||||
[taxonomies]
|
||||
tag = "tags"
|
||||
|
|
|
@ -4,6 +4,7 @@ defaultContentLanguage: en
|
|||
title: Cupper
|
||||
theme: cupper-hugo-theme
|
||||
googleAnalytics: UA-123456789-1
|
||||
disqusShortname: yourdiscussshortname
|
||||
|
||||
taxonomies:
|
||||
tag: tags
|
||||
|
|
|
@ -430,6 +430,20 @@ caption {
|
|||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
/* Disqus Comments */
|
||||
#disqus-container {
|
||||
font-size: 0.85rem;
|
||||
border: 1px solid;
|
||||
padding: 1.5rem;
|
||||
max-height: 50vh !important;
|
||||
}
|
||||
#disqus-button {
|
||||
width: 100%;
|
||||
}
|
||||
#disqus-comments {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Pattern lists */
|
||||
.patterns-list {
|
||||
list-style: none;
|
||||
|
|
13
layouts/partials/disqus.html
Normal file
13
layouts/partials/disqus.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<div id="disqus-container">
|
||||
{{ $ctx := . }}
|
||||
{{ with .Site.DisqusShortname }}
|
||||
<button id="disqus-button" onclick="showComments()">Show comments</button>
|
||||
<div id="disqus-comments">
|
||||
{{ if eq . "yourdiscussshortname" }}
|
||||
<p>Disqus comments are disabled.</p>
|
||||
{{ else }}
|
||||
{{ template "_internal/disqus.html" $ctx }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
|
@ -26,10 +26,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if ne .Params.toc false }}
|
||||
{{ partial "toc" . }}
|
||||
{{ end }}
|
||||
{{ .Content }}
|
||||
</main>
|
||||
{{ partial "disqus.html" . }}
|
||||
{{ end }}
|
||||
|
|
|
@ -131,3 +131,12 @@
|
|||
}
|
||||
});
|
||||
}());
|
||||
|
||||
/* Disqus comments */
|
||||
function showComments() {
|
||||
var disqusButton = document.getElementById('disqus-button');
|
||||
disqusButton.remove();
|
||||
|
||||
var disqusComments = document.getElementById('disqus-comments');
|
||||
disqusComments.style.display = 'block';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user