control comment system in partials/comments.html
This commit is contained in:
parent
9f8b0c3194
commit
28511efd08
|
@ -1,3 +1,9 @@
|
||||||
{{- /* Comments area start */ -}}
|
{{- /* You can add your own layouts/comments.html to override this file */ -}}
|
||||||
{{- /* to add comments read => https://gohugo.io/content-management/comments/ */ -}}
|
|
||||||
{{- /* Comments area end */ -}}
|
{{- with site.Params.commentSystem.disqus -}}
|
||||||
|
{{- partial "disqus.html" . }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- with site.Params.commentSystem.telegramWidget -}}
|
||||||
|
{{- partial "telegram_widget.html" . }}
|
||||||
|
{{- end -}}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{{- /* Comments js area start */ -}}
|
|
||||||
{{- /* to add comments read => https://gohugo.io/content-management/comments/ */ -}}
|
|
||||||
{{- /* Comments js area end */ -}}
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
{{- /* You can add your own layouts/comments_script.html to override this file */ -}}
|
||||||
|
|
||||||
|
{{- with site.Params.commentSystem.disqus -}}
|
||||||
|
{{ partial "disqus_script.html" . }}
|
||||||
|
{{- end -}}
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="disqus-container">
|
||||||
|
<div id="disqus_thread"></div>
|
||||||
|
</div>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<script type="text/javascript">
|
||||||
|
var disqus_config = function () {
|
||||||
|
this.page.url = '{{ .Page.Permalink }}'; // Replace PAGE_URL with your page's canonical URL variable
|
||||||
|
this.page.identifier = '{{ .Page.Permalink | path.Base }}'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
|
||||||
|
};
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
let disqusEmbedLoaded = window.disqusEmbedLoaded;
|
||||||
|
if (disqusEmbedLoaded) {
|
||||||
|
// Use DISQUS.reset instead of reloading embed.js please.
|
||||||
|
// https://help.disqus.com/en/articles/1717163-using-disqus-on-ajax-sites
|
||||||
|
DISQUS.reset({
|
||||||
|
reload: true,
|
||||||
|
config: disqus_config,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var d = document, s = d.createElement('script');
|
||||||
|
s.src = '//' + '{{ site.Params.commentSystem.disqus.shortname }}' + '.disqus.com/embed.js';
|
||||||
|
s.setAttribute('data-timestamp', +new Date());
|
||||||
|
// prevent the <script> from loading mutiple times by InstantClick
|
||||||
|
s.setAttribute('data-no-instant', '')
|
||||||
|
d.head.appendChild(s);
|
||||||
|
|
||||||
|
window.disqusEmbedLoaded = true;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
|
@ -126,5 +126,5 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if not (.Param "noComments") }}
|
{{- if not (.Param "noComments") }}
|
||||||
{{- partial "comments_js.html" . }}
|
{{- partial "comments_script.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{{- with site.Params.commentSystem.telegramWidget }}
|
||||||
|
<script async
|
||||||
|
src="https://telegram.org/js/telegram-widget.js?19"
|
||||||
|
data-telegram-discussion="{{ .channel }}"
|
||||||
|
data-comments-limit="{{ .limit | default 10 }}"
|
||||||
|
{{ with .accentColor }}data-color="{{ . }}"{{ end }}></script>
|
||||||
|
{{- end }}
|
Loading…
Reference in New Issue