marcantondahmen / automad

A flat-file content management system and template engine
https://automad.org
MIT License
631 stars 37 forks source link

Feature Request: Disqus Integration #41

Open BoredBrownBear opened 2 years ago

BoredBrownBear commented 2 years ago

Hi,

I would like to request a feature to integrate Disqus for an easy comments feature for automad. While it is technically possible to integrate Disqus with the current features, there are a few drawbacks:

We need to place the following Disqus code:

<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 = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
    this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() { // DON'T EDIT BELOW THIS LINE
    var d = document, s = d.createElement('script');
    s.src = 'https://your-disqus-site-name.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">comments powered by Disqus.</a></noscript>

From here we can see the limitations:

  1. There seems to be no way of appending this to blog posts (for example), apart from placing it in the Item Footer field. But placing it there would most likely break your current theme, since the Disqus widget's width will extend to the footer's width rather than the article's width.
  2. It would be great if we could have a post variable that we can use to get PAGE_URL, instead of just inputting it manually.
  3. Same as 2, PAGE_IDENTIFIER can just be the post's slug, but a post variable feature would be great.

Anyway, I'm enjoying automad so far!

marcantondahmen commented 2 years ago

Hi, adding plugins like that will be addressed in the next major release.