only show comments on non-pages, and add noscript text

This commit is contained in:
2019-10-17 01:15:53 +02:00
parent dcd79bb343
commit cdd5d40236
2 changed files with 11 additions and 1 deletions

View File

@@ -1,5 +1,15 @@
{{ if ne .Params.page true }}
<div class="comments-container"> <div class="comments-container">
<h5>Comments</h5> <h5>Comments</h5>
<noscript>
<p class="bg-info" style="text-align: center; padding: 5px;">
Comments are only visible with JavaScript enabled. They are
dynamically loaded from Mastodon. The code to display the
comments is Free Software and <a
href="https://src.mehl.mx/mxmehl/hugo-mastodon-comments">completely
transparent</a>.
</p>
</noscript>
<div id="statistics"> <div id="statistics">
<div id="like-count-container"></div><div id="reblog-count-container"></div><div id="reply-count-container"></div> <div id="like-count-container"></div><div id="reblog-count-container"></div><div id="reply-count-container"></div>
</div> </div>
@@ -8,6 +18,7 @@
<div class="clear"></div> <div class="clear"></div>
<div id="reference"></div> <div id="reference"></div>
</div> </div>
{{ end }}
<script>var RelPermalink="{{ .RelPermalink }}"</script> <script>var RelPermalink="{{ .RelPermalink }}"</script>
<script>var MastodonUser="{{ .Site.Params.mastodoncomments.user }}"</script> <script>var MastodonUser="{{ .Site.Params.mastodoncomments.user }}"</script>

View File

@@ -2,7 +2,6 @@ $(document).ready(function() {
// check if we show a blog post or not. Regex is defined in site-wide config // check if we show a blog post or not. Regex is defined in site-wide config
var patt = new RegExp(BlogRegex); var patt = new RegExp(BlogRegex);
console.log(patt);
var isArticle = patt.test(RelPermalink); var isArticle = patt.test(RelPermalink);
if (isArticle === false) { if (isArticle === false) {
console.log("Not a blog post, no need to search for comments"); console.log("Not a blog post, no need to search for comments");