g0's disqus on Blogger ghetto hack

1) I like showing whole posts --not just snippets-- on the front page of aLog --I know I am weird.

2) I don't like disqus comments popping on the front page, the show older, and the search (blog/search* ) pages that show more than a Post. ( example )

3) It is OK for the IPduh Tools page to show disqus comments ( for now ).

4) I also want a Link on every post saying Comment showing up on every page of the blog that I don't want disqus comments. ( huh! confusing? remember 2? )

There must be some political correct way of doing that on Blogger. One that most probably would require me browsing through half the Internet to find. Here is my "it took a whole 20 minutes to put together and takes less than 5 min to install and works just exactly as I wanted it" shot at it.

The template needs a javascript include in the head. Something like the following:
<script src='http://kod.ipduh.com/js/alogjs.js' type='text/javascript'></script>
This way someone who does not have some other place to host the js is screwed. Bummer indeed and I tried to put all the javascript in the Blogger template but I could not use any && there, and after I spent more than 5 min trying to figure out what is wrong and then tried to encode && a couple of different ways with no success I gave up. Hmm! it just hit me! One could use nested ifs to avoid && and that should be fine for the Blogger template.

Something like the following should be put in the Template where you want to put the disqus comments:
<a name='comment'> </a> <div id='disqus_thread'></div>
<script type='text/javascript'>

The alogjs.js looks like that:
/*g0 2012 for alog.ipduh.com --http://ipduh.com/contact */

var disqus_shortname ='thealog'; // set your disqus forum shortname
var blog='alog.ipduh.com'; // set this too

function put_disqus() 

var blog_url='http://'+blog+'/';
var regex_str='http:\/\/'+blog+'\/search';
var searchregex=new RegExp(regex_str,"i");

if (window.location.href.toString() != blog_url.toString() && !searchregex.test(window.location.href.toString()) )
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);


function print_comment_link(path) 

if(window.location.pathname.toString() != path.toString() ) 
document.write('<a href="http://'+blog+path+'#comment">Comment</a>');

Replace the if statement in put_disqus() with nested ifs if you want to put this code in the Blogger template and having issues with the AND ( && ) operator.

and then put on the bottom of every post something like the following:
<script type="text/javascript" language="javascript">
Yeah , I looked (not very hard ) through this template's variable names to find the path but not cigar. So I am setting it manually for each post for now.

That's all folks.

g0's disqus on Blogger ghetto hack