User Tools

Site Tools


doc:tips:adddisqus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:tips:adddisqus [2020/04/15 14:19] arviddoc:tips:adddisqus [2022/07/09 02:14] (current) – The first big code block code tag was messed up and made the guide hard to follow. (Fixed the layout of code tags) scrapblox
Line 4: Line 4:
  
 Please refer to the forum if you have suggestions or questions regarding this guide. Please refer to the forum if you have suggestions or questions regarding this guide.
 +
 +==== The Basics ====
  
 The following assumes you already have a Disqus site created, and you've got your Disqus Universal Code ready. If not, please visit https://disqus.com/profile/signup/ and do that first. The following assumes you already have a Disqus site created, and you've got your Disqus Universal Code ready. If not, please visit https://disqus.com/profile/signup/ and do that first.
Line 93: Line 95:
 <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>{/literal} <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>{/literal}
  </div></code>  </div></code>
 +
 +Remember to change "YOUR-SITE-PAGE.URL/YOUR-PAGE.php" to your flatpress blogs address, change "YOUR-DISQUS-SITE-NAME" to the shortname of your disqus site, and to change the identifier to whatever you like, or make it blank, it's up to you.
  
 You can obviously place this where is best suited in your own code if your theme doesn't contain a <ul> here, etc, but towards the bottom after the rest of the content is probably best. You can obviously place this where is best suited in your own code if your theme doesn't contain a <ul> here, etc, but towards the bottom after the rest of the content is probably best.
Line 136: Line 140:
  
 And finally, we're going to add the following discord count script right above the </body> tag in your footer.tpl file: And finally, we're going to add the following discord count script right above the </body> tag in your footer.tpl file:
-<code><script id="dsq-count-scr" src="//flat-1.disqus.com/count.js" async></script></code>+<code><script id="dsq-count-scr" src="https://YOUR-DISQUS-SITE-NAME.disqus.com/count.js" async></script></code> 
 + 
 +Remember to change YOUR-DISQUS-SITE-NAME to your disqus comment site shortname.
  
 And there you have it, your Disqus comments system will be fully operational, and not to mention that all of your posts are now on their own pages, making the whole thing a bit nicer. You might have to visit your blog entry at least once for the counter to work, but that is a fault with Disqus and not Flatpress or this modification. And there you have it, your Disqus comments system will be fully operational, and not to mention that all of your posts are now on their own pages, making the whole thing a bit nicer. You might have to visit your blog entry at least once for the counter to work, but that is a fault with Disqus and not Flatpress or this modification.
  
-If you want to see it working before you use it yourselfthen you can find a live demo of it working on "Deckay 4.Deckay Blacktheme athttp://www.clockworkknight.com/flat/+==== Adding to static pages ==== 
 + 
 +Now, depending on how you have your site set up, and if you're like me, you'll want to display comments on static pages too! 
 + 
 +To do that is very simple. Simply open up your theme's satic.tpl file and find where you want to put the comment section. Once you've done that, paste and edit the following code (matches the earlier code): 
 + 
 +<code><P> <div id="disqus_thread"></div> 
 +{literal}<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 = YOUR-SITE-PAGE.URL/static.php;  // Replace PAGE_URL with your page's canonical URL variable 
 +this.page.identifier = YOUR_UNIQUE_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>{/literal} 
 + </div></code> 
 + 
 +Remember to change "YOUR-SITE-PAGE.URL" to your flatpress blogs address (keep the /static.php), change "YOUR-DISQUS-SITE-NAME" to the shortname of your disqus site, and to change the identifier to whatever you like, or make it blank, it's up to you. That adds it to every static page! 
 + 
 +BUTwhat if you've done this and now you don't want disqus comments on every static page? Easy! 
 + 
 +You simply add the following code to the static pages you DON'T want disqus comments to appear on: 
 +<code><style>#disqus_thread { 
 +display:none; 
 +}</style></code> 
 + 
 +And that is that! 
 + 
 +==== Comment count in the admin panel ==== 
 + 
 +(This addition was created by ScrapBlox): 
 + 
 +Adding onto what was already said about this 
 + 
 +To get the comment count to show up in the //admin entry list// page. 
 + 
 +Inside the //footer.tpl// make sure the following line is there 
 +Change [INSERT SHORT NAME] to your disqus comment section shortname (Can find on general tab in admin dashboard) 
 + 
 + 
 +<code><script id="dsq-count-scr" src="//[INSERT SHORT NAME].disqus.com/count.js" async></script></code> 
 +So after that you want to open //Blog > admin > panels > entry > admin.entry.list.tpl// 
 +Find the following code 
 + 
 +<code><td><a class="link-general 
 +href="{$panel_url|action_link:commentlist}&amp;entry={$id}"> 
 +{* Compatibility with pre-0.702 *} 
 +{$commentcount|default:$comments}</a></td> 
 +<td></code> 
 +And change that to 
 + 
 +<code><td><a class="link-general"  
 +href="{$id|link:post_link}#disqus_thread"> 
 +{* Compatibility with pre-0.702 *} 
 +{$commentcount|default:$comments}</a></td> 
 +<td></code>
  
-If you just so happen to run into any problems, then I'll try to help, but it's a pretty simple guide and I'm sure it will be easy enough to implement!+==== Closing Remarks ==== 
 +If you just so happen to run into any problems, then we'll try to help, but it's a pretty simple guide and I'm sure it will be easy enough to implement!
doc/tips/adddisqus.1586953193.txt.gz · Last modified: 2020/04/15 14:19 by arvid

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki