Merge pull request #201 from igorkulman/delayed-disqus

Delayed Disqus comments
This commit is contained in:
Michael Romero 2018-10-26 00:53:33 -07:00 committed by GitHub
commit b6d8e54497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 189 additions and 48 deletions

View File

@ -25,6 +25,7 @@ pygmentsCodefencesGuessSyntax = true
readingTime = true
useHLJS = true
socialShare = true
delayDisqus = true
showRelatedPosts = true
# gcse = "012345678901234567890:abcdefghijk" # Get your code from google.com/cse. Make sure to go to "Look and Feel" and change Layout to "Full Width" and Theme to "Classic"

View File

@ -63,6 +63,12 @@
- id: yourWebsite
translation: "Seu website"
# Delayed Disqus
- id: show
translation: "Mostrar"
- id: comments
translation: "comentários"
# Related posts
- id: seeAlso
translation: "Veja também"
translation: "Veja também"

View File

@ -49,20 +49,26 @@
# Staticman
- id: noComment
translation: "No comment"
translation: "Kein Kommentar"
- id: oneComment
translation: "comment"
translation: "Kommentar"
- id: moreComment
translation: "comments"
translation: "Kommentare"
- id: useMarkdown
translation: "You can use Markdown syntax"
translation: "Sie können Markdown-Syntax verwenden"
- id: yourName
translation: "Your name"
translation: "Irh Name"
- id: yourEmail
translation: "Your email address"
translation: "Ihre Emailadresse"
- id: yourWebsite
translation: "You website"
translation: "Ihre Website"
# Delayed Disqus
- id: show
translation: "Zeige"
- id: comments
translation: "Kommentare"
# Related posts
- id: seeAlso
translation: "Siehe auch"
translation: "Siehe auch"

View File

@ -63,6 +63,12 @@
- id: yourWebsite
translation: "You website"
# Delayed Disqus
- id: show
translation: "Show"
- id: comments
translation: "comments"
# Related posts
- id: seeAlso
translation: "See also"
translation: "See also"

View File

@ -63,6 +63,12 @@
- id: yourWebsite
translation: "Via retpaĝaro"
# Delayed Disqus
- id: show
translation: "Montru"
- id: comments
translation: "komentoj"
# Related posts
- id: seeAlso
translation: "Vidu ankaŭ"
translation: "Vidu ankaŭ"

View File

@ -49,20 +49,26 @@
# Staticman
- id: noComment
translation: "No comment"
translation: "Sin comentarios"
- id: oneComment
translation: "comment"
translation: "comentario"
- id: moreComment
translation: "comments"
translation: "comentarios"
- id: useMarkdown
translation: "You can use Markdown syntax"
translation: "Puedes usar la sintaxis de Markdown"
- id: yourName
translation: "Your name"
translation: "Tu nombre"
- id: yourEmail
translation: "Your email address"
translation: "Tu correo electrónico"
- id: yourWebsite
translation: "You website"
translation: "Tu sitio web"
# Delayed Disqus
- id: show
translation: "Mostrar"
- id: comments
translation: "comentarios"
# Related posts
- id: seeAlso
translation: "Ver también"
translation: "Ver también"

View File

@ -63,6 +63,12 @@
- id: yourWebsite
translation: "Votre site web"
# Delayed Disqus
- id: show
translation: "Afficher"
- id: comments
translation: "commentaires"
# Related posts
- id: seeAlso
translation: "Voir également"
translation: "Voir également"

View File

@ -63,6 +63,12 @@
- id: yourWebsite
translation: "Il tuo website"
# Delayed Disqus
- id: show
translation: "Mostra"
- id: comments
translation: "commenti"
# Related posts
- id: seeAlso
translation: "Guarda anche"
translation: "Guarda anche"

View File

@ -63,6 +63,12 @@
- id: yourWebsite
translation: "You website"
# Delayed Disqus
- id: show
translation: "ショー"
- id: comments
translation: "コメント"
# Related posts
- id: seeAlso
translation: "も参照してください"
translation: "も参照してください"

View File

@ -63,6 +63,12 @@
- id: yourWebsite
translation: "Din webside"
# Delayed Disqus
- id: show
translation: "Vis"
- id: comments
translation: "kommentarer"
# Related posts
- id: seeAlso
translation: "Se også"
translation: "Se også"

View File

@ -63,6 +63,12 @@
- id: yourWebsite
translation: "Jouw website"
# Delayed Disqus
- id: show
translation: "Laat"
- id: comments
translation: "reacties zien"
# Related posts
- id: seeAlso
translation: "Zie ook"
translation: "Zie ook"

View File

@ -49,20 +49,26 @@
# Staticman
- id: noComment
translation: "No comment"
translation: "Bez komentarza"
- id: oneComment
translation: "comment"
translation: "komentarz"
- id: moreComment
translation: "comments"
translation: "komentarzy"
- id: useMarkdown
translation: "You can use Markdown syntax"
translation: "Możesz użyć składni Markdown"
- id: yourName
translation: "Your name"
translation: "Twoje imię"
- id: yourEmail
translation: "Your email address"
translation: "Twój adres email"
- id: yourWebsite
translation: "You website"
translation: "Twoja strona internetowa"
# Delayed Disqus
- id: show
translation: "Pokaż"
- id: comments
translation: "komentarzy"
# Related posts
- id: seeAlso
translation: "Zobacz też"
translation: "Zobacz też"

View File

@ -49,20 +49,26 @@
# Staticman
- id: noComment
translation: "No comment"
translation: "Без комментариев"
- id: oneComment
translation: "comment"
translation: "комментарий"
- id: moreComment
translation: "comments"
translation: "комментарии"
- id: useMarkdown
translation: "You can use Markdown syntax"
translation: "Вы можете использовать синтаксис Markdown"
- id: yourName
translation: "Your name"
translation: "Ваше имя"
- id: yourEmail
translation: "Your email address"
translation: "Ваш адрес электронной почты"
- id: yourWebsite
translation: "You website"
translation: "Ваш сайт"
# Delayed Disqus
- id: show
translation: "Показать"
- id: comments
translation: "комментариев"
# Related posts
- id: seeAlso
translation: "Смотрите также"
translation: "Смотрите также"

View File

@ -49,20 +49,26 @@
# Staticman
- id: noComment
translation: "No comment"
translation: "没有意见"
- id: oneComment
translation: "comment"
translation: "评论"
- id: moreComment
translation: "comments"
translation: "评论"
- id: useMarkdown
translation: "You can use Markdown syntax"
translation: "您可以使用Markdown语法"
- id: yourName
translation: "Your name"
translation: "你的名字"
- id: yourEmail
translation: "Your email address"
translation: "您的电子邮件地址"
- id: yourWebsite
translation: "You website"
translation: "你的网页"
# Delayed Disqus
- id: show
translation: "显示"
- id: comments
translation: "条评论"
# Related posts
- id: seeAlso
translation: "也可以看看"
translation: "也可以看看"

View File

@ -53,9 +53,23 @@
{{ if (.Params.comments) | or (and (or (not (isset .Params "comments")) (eq .Params.comments nil)) (and .Site.Params.comments (ne .Type "page"))) }}
{{ if .Site.DisqusShortname }}
{{ if .Site.Params.delayDisqus }}
<div class="disqus-comments">
<button id="show-comments" class="btn btn-default" type="button">{{ i18n "show" }} <span class="disqus-comment-count" data-disqus-url="{{ trim .Permalink "/" }}">{{ i18n "comments" }}</span></button>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_config = function () {
this.page.url = '{{ trim .Permalink "/" }}';
};
</script>
</div>
{{ else }}
<div class="disqus-comments">
{{ template "_internal/disqus.html" . }}
</div>
{{ end }}
{{ end }}
{{ if .Site.Params.staticman }}
<div class="staticman-comments">

View File

@ -112,4 +112,28 @@
<!-- End Piwik Code -->
{{ end }}
{{ if (.Site.Params.delayDisqus) (and .Site.DisqusShortname) }}
<!-- Delayed Disqus -->
<script type="text/javascript">
$(function(){
$('#show-comments').on('click', function(){
var disqus_shortname = '{{ .Site.DisqusShortname }}';
(function() {
var disqus = document.createElement('script');
disqus.type = 'text/javascript';
disqus.async = true;
disqus.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(disqus);
})();
$(this).hide();
});
});
</script>
<script id="dsq-count-scr" src="//{{ .Site.DisqusShortname }}.disqus.com/count.js" async></script>
<!-- End Delayed Disqus -->
{{ end }}
{{- partial "footer_custom.html" . }}

View File

@ -743,7 +743,31 @@ div.splitbox div.right {
float:left;}
}
/* Delayed Disqus */
.disqus-comments button {
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
text-transform: uppercase;
font-size: 14px;
font-weight: 800;
letter-spacing: 1px;
padding: 10px 5px;
background: #FFF;
border-radius: 0;
color: #404040;
}
@media only screen and (min-width: 768px) {
.disqus-comments button {
padding: 15px 25px;
}
}
.disqus-comments button:hover,
.disqus-comments button:focus {
color: #FFF;
background: #0085a1;
border: 1px solid #0085a1;
/* Related posts */
h4.see-also {
margin-top: 20px
}