<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Rails Blog comments on How to Add Digg Buttons to Your Typo Blog</title>
    <link>http://railsweek.com/blog/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Rails Blog comments</description>
    <item>
      <title>"How to Add Digg Buttons to Your Typo Blog" by smeade</title>
      <description>&lt;p&gt;Here is how I added Digg voting buttons to a Rails powered Typo blog.  Digg buttons come in several types.  You can build out a full-size Digg button, a compact sized one, or use your own image.  I&amp;#8217;m adding compact buttons.&lt;/p&gt;


	&lt;p&gt;See &lt;a href="http://digg.com/tools/integrate"&gt;here&lt;/a&gt; for details on Digg button html code and all the different options.  When you have chosen what options you want to use, here&amp;#8217;s the code that worked for me.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;app/views/articles/read.rhtml&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;This is the view in Typo rendered when a  single article is shown.  Because this view is the view to the article, you do not need to tell Digg the &lt;span class="caps"&gt;URL&lt;/span&gt;.  (Digg assumes the current &lt;span class="caps"&gt;URL&lt;/span&gt; when the diggthis script is called).&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s code that worked for me.  Again, review the details on the Digg site for other options.  The key for Typo users is that the digg_title can be set to the name of the article.  I inserted this code right after the line with &lt;code&gt;author_link(@article)&lt;/code&gt;.&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
&amp;lt;script type="text/javascript"&amp;gt;
    digg_skin = 'compact';
    digg_title = &amp;lt;%= "'" + h(@article.title) + "'" %&amp;gt;;
    &amp;lt;/script&amp;gt;
&amp;lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;   
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;app/views/articles/_article.rhtml&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;_article.rhtml is a partial used in typo to show an article in the blog&amp;#8217;s list of articles.  Because each article in the list will have a different &lt;span class="caps"&gt;URL&lt;/span&gt; to send to Digg, you will want to set the &lt;code&gt;digg_url&lt;/code&gt; parameter as in this example. In the call to &lt;code&gt;article_url&lt;/code&gt;, the &lt;code&gt;false&lt;/code&gt; parameter makes sure that the entire path is set in the url.  I added this code right before the &lt;code&gt;&amp;lt;%= article.body_html %&amp;gt;&lt;/code&gt; line.&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
&amp;lt;p&amp;gt;
      &amp;lt;script type="text/javascript"&amp;gt;
    digg_skin  = 'compact';
    digg_title = &amp;lt;%= "'" + h(article.title) + "'" %&amp;gt;;
    digg_url   = &amp;lt;%= "'" + article_url(article, false) + "'" %&amp;gt;;
    &amp;lt;/script&amp;gt;
    &amp;lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;   
&amp;lt;/p&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;Try it out&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Now, next time you enter a new article, you&amp;#8217;ll have Digg buttons where readers can Digg your writing.  Try it out.&lt;/p&gt;

</description>
      <pubDate>Sun,  4 Mar 2007 19:02:00 EST</pubDate>
      <guid>&lt;a href="/blog/articles/2007/03/04/how-to-add-digg-buttons-to-a-typo-blog"&gt;How to Add Digg Buttons to Your Typo Blog&lt;/a&gt;</guid>
      <link>&lt;a href="/blog/articles/2007/03/04/how-to-add-digg-buttons-to-a-typo-blog"&gt;How to Add Digg Buttons to Your Typo Blog&lt;/a&gt;</link>
    </item>
  </channel>
</rss>
