I built a site using Jekyll hosted on Github Pages:
Jekyll _config.yml:
# Comments
disqus_shortname: bad3r
Disqus configuration in _layout/post.html :
<div class="comments-wrapper">
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
*/
var disqus_config = function() {
this.page.url = '{{ absolute_url }}{{ page.url }}'; /*Replace PAGE_URL with your page's canonical URL variable*/
this.page.identifier = '{{ page.url }}'; /*Replace PAGE_IDENTIFIER with your page's unique identifier variable*/
};
(function() { /* dont endit below this line */
var d = document,
s = d.createElement('script');
/* https://bad3r.disqus.com/embed.js */
/* 'https://{{ site.disqus_shortname }}.disqus.com/embed.js' */
s.src = 'https://{{ site.disqus_shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
</div>
<!-- /.comments-wrapper -->
I have enabled comments in the post Jekyll front-matter:
---
layout: post
title: "Welcome to my new blog"
date: 2018-05-25
excerpt: "working on building my blog, here is an example post"
image: "/images/workProgress.jpg"
comments: true
---
link to the post where disque shows an error message here, code on github here
if you open the console on the page you will see the error:
Content Security Policy: The page’s settings blocked the loading of a resource at self (“script-src”).
i didnt have a Content Security Policy when i first encountered the error but i tried to implement one and i added the CSP in the _includes/head.html :
<!-- CSP(Content Security Policy) -->
<META HTTP-EQUIV='Content-Security-Policy' CONTENT="default-src 'self' ; script-src 'self' 'unsafe-inline' *.disqus.com a.disquscdn.com requirejs.org www.google-analytics.com; style-src 'self' 'unsafe-inline' a.disquscdn.com; img-src 'self' *; media-src 'self' ; frame-src disqus.com;">
and the _includes/head.html is included in the start of all _layouts/*.html
I have no idea why this error still occurs.