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 [2022/06/14 20:45] – Added the comment count inside the admin entry list scrapbloxdoc: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 19: Line 21:
  
 Now you're going to want to make a new file in the same directory called "single-default.tpl", and you're going to want to copy the contents of your "entry-default.tpl" like so, and then we're going to paste that into our newly created single-default.tpl:\\ Now you're going to want to make a new file in the same directory called "single-default.tpl", and you're going to want to copy the contents of your "entry-default.tpl" like so, and then we're going to paste that into our newly created single-default.tpl:\\
-[code] <div itemscope itemtype="http://schema.org/BlogPosting" id="{$id}" class="entry {$date|date_format:"y-%Y m-%m d-%d"}">+<code> <div itemscope itemtype="http://schema.org/BlogPosting" id="{$id}" class="entry {$date|date_format:"y-%Y m-%m d-%d"}">
  {* using the following way to print the date, if more *}   {* using the following way to print the date, if more *} 
  {* than one entry have been written the same day, *}   {* than one entry have been written the same day, *} 
Line 58: Line 60:
   
   
- </div>[/code]+ </div></code>
  
 Now we need to do some editing! Now we need to do some editing!
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 a "Deckay 4.0 - Deckay Black" theme athttp://www.clockworkknight.com/flat/+==== Adding to static pages ==== 
 + 
 +Now, depending on how you have your site set upand if you're like me, you'll want to display comments on static pages too! 
 + 
 +To do that is very simpleSimply 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! 
 + 
 +BUT, what 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!
  
-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!+==== Comment count in the admin panel ====
  
-----+(This addition was created by ScrapBlox):
  
-Addition by (ScrapBlox): 
 Adding onto what was already said about this Adding onto what was already said about this
  
Line 171: Line 213:
 {$commentcount|default:$comments}</a></td> {$commentcount|default:$comments}</a></td>
 <td></code> <td></code>
 +
 +==== 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.1655232335.txt.gz · Last modified: by scrapblox

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki