<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Dev411 Blog: Category hacks</title>
  <subtitle type="html">John Wang on Technology</subtitle>
  <id>tag:www.dev411.com,2005:Typo</id>
  <generator uri="http://www.typosphere.org" version="4.0">Typo</generator>
  <link href="http://www.dev411.com/blog/xml/atom/category/feed.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.dev411.com/blog/tag/hacks" rel="alternate" type="text/html"/>
  <updated>2007-06-16T13:18:12-05:00</updated>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:99950a82-9949-47c6-84ff-65e929f19659</id>
    <published>2006-09-02T12:20:00-05:00</published>
    <updated>2007-06-16T13:18:12-05:00</updated>
    <title type="html">Notable social bookmarking/networking for Typo</title>
    <link href="http://www.dev411.com/blog/2006/09/02/notable-social-bookmarking-networking-for-typo" rel="alternate" type="text/html"/>
    <category term="typo" scheme="http://www.dev411.com/blog/tag/typo" label="typo"/>
    <category term="hacks" scheme="http://www.dev411.com/blog/tag/hacks" label="hacks"/>
    <summary type="html">&lt;p&gt;Benjamin Gorlick asked for  &lt;a href="http://www.calevans.com/view.php/page/notable"&gt;WP-Notable&lt;/a&gt;-style social bookmarking/networking links on the &lt;span class="fix"&gt;#typo&lt;/span&gt; IRC channel so I put one together in the form of a single view (template file). WP-Notable, by Cal Evans, displays a row of icons with links to social bookmarking/networking sites under your blog article allowing for easy posting tovarious social bookmarking sites.&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;Benjamin Gorlick asked for  &lt;a href="http://www.calevans.com/view.php/page/notable"&gt;WP-Notable&lt;/a&gt;-style social bookmarking/networking links on the &lt;span class="fix"&gt;#typo&lt;/span&gt; IRC channel so I put one together in the form of a single view (template file). WP-Notable, by Cal Evans, displays a row of icons with links to social bookmarking/networking sites under your blog article allowing for easy posting tovarious social bookmarking sites.&lt;/p&gt;

&lt;p&gt;All the icons used here are from the WP-Notable plugin and look like the following:&lt;/p&gt;

&lt;div style="text-align:center"&gt;&lt;img src="http://www.dev411.com/images/notable/notable.icon_bar.png" alt="notable icon bar"/&gt;&lt;/div&gt;

&lt;p&gt;Without further ado, here are the 4 steps (optional 5th step) to get this on your Typo blog:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Copy the &lt;span class="fix"&gt;&lt;a href="http://www.dev411.com/typo/notable/_article_notable_v4.1.1.rhtml"&gt;_article_notable_v4.1.1.rhtml&lt;/a&gt;&lt;/span&gt; or &lt;span class="fix"&gt;&lt;a href="http://www.dev411.com/typo/notable/_article_notable_v4.0.0.rhtml"&gt;_article_notable_v4.0.0.rhtml&lt;/a&gt;&lt;/span&gt; partial include file to your Typo install's &lt;span class="fix"&gt;app/views/articles/&lt;/span&gt; directory and rename it &lt;span class="fix"&gt;_article_notable.rhtml&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;I've put the code for this all in a single template file to keep the modification in a single place since I have a growing number of mods. There is an array of information for each site. Right now it will create this array each time it is included which may be several times on the homepage. This could be put into the config file or a helper so it gets instantiated only once but I left it in the template since it means updating fewer files and the HTML pages are cached so I don't think it's a big deal. It's also possible to create a notable_link method to generate each link instead of having it created in the template.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Install the icons by extracting the png files from &lt;a href="http://www.dev411.com/typo/notable/typo_notable.tgz"&gt;typo_notable.tgz&lt;/a&gt; into your &lt;span class="fix"&gt;/images/notable&lt;/span&gt; directory. This directory is ferenced in the &lt;span class="fix"&gt;_article_notable.rhtml&lt;/span&gt; file so edit that file if you wish to change the icon locations. The tarball also includes the rhtml file just for completeness.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Add the following to &lt;span class="fix"&gt;index.rhtml&lt;/span&gt; file under the &lt;span class="fix"&gt;"Read more..."&lt;/span&gt; article_link line.  This file is either in &lt;span class="fix"&gt;app/views/articles/&lt;/span&gt; or your theme directory.&lt;/p&gt;

&lt;pre&gt;&amp;lt;%= render :partial=&gt;"article_notable",:locals=&gt;{:article=&gt;article} %&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Edit the &lt;span class="fix"&gt;read.rhtml&lt;/span&gt; file and add the following line under the where the article body is rendered. In Typo 4.1.1, place this line under the &lt;span class="fix"&gt;&amp;lt;%= html(@article) %&amp;gt;&lt;/span&gt; line and in Typo 4.0.0, place this line under the &lt;span class="fix"&gt;&amp;lt;%= @article.full_html %&amp;gt;&lt;/span&gt; line. The &lt;span class="fix"&gt;read.rhtml&lt;/span&gt; file is either in &lt;span class="fix"&gt;app/views/articles/&lt;/span&gt; or your theme directory.&lt;/p&gt;

&lt;pre&gt;&amp;lt;%= render :partial=&gt;"article_notable",:locals=&gt;{:article=&gt;@article} %&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; If you want to style the notable icons, there are some CSS classes used &lt;span class="fix"&gt;typo_notable_line&lt;/span&gt;,&lt;span class="fix"&gt;typo_notable&lt;/span&gt; and &lt;span class="fix"&gt;typo_notable_icon&lt;/span&gt;. These are easy to spot in the &lt;span class="fix"&gt;_article_notable.rhtml&lt;/span&gt; file.&lt;/p&gt;

&lt;p&gt;So far I've only tested del.icio.us and digg and the links work since that's where I have accounts. Please let me know if any of the links don't work (or work) for you. Enjoy!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Thanks to Benjamin Gorlick for comments to these instructions.&lt;/p&gt;</content>
  </entry>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:4062f3dbcec251fe52a4d8393d7f1511</id>
    <published>2006-07-12T01:48:00-05:00</published>
    <updated>2007-06-16T12:30:22-05:00</updated>
    <title type="html">Scriptaculous article slider for Typo themes</title>
    <link href="http://www.dev411.com/blog/2006/07/12/scriptaculous-article-slider-for-typo-themes" rel="alternate" type="text/html"/>
    <category term="typo" scheme="http://www.dev411.com/blog/tag/typo" label="typo"/>
    <category term="hacks" scheme="http://www.dev411.com/blog/tag/hacks" label="hacks"/>
    <category term="dhtml" scheme="http://www.dev411.com/blog/tag/dhtml" label="dhtml"/>
    <category term="scriptaculous" scheme="http://www.dev411.com/blog/tag/scriptaculous" label="scriptaculous"/>
    <summary type="html">&lt;p&gt;Several Typo themes have nice DHTML effects and I thought it would be useful to extract some of these for use in other themes. In particular I am interested in adding &lt;a href="http://www.typogarden.org/articles/2005/11/16/modernist-theme"&gt;Modernist&lt;/a&gt;'s DHTML &lt;a href="http://script.aculo.us"&gt;Scriptaculous&lt;/a&gt; ScrollTo article slider to my modded Azure theme. You can see this in action at &lt;a href="http://poocs.net"&gt;poocs.net&lt;/a&gt; which is currently running Modernist. This article covers the steps necessary to repurpose the DHTML article slider and involves templates, CSS and images. I've shown how Modernist does it and, where applicable, how I prefer to do it. It turns out to be pretty easy.&lt;/p&gt;

&lt;p&gt;I've added this feature to my test system, however it's not here yet because I've decided to create a custom Dev411_Azure theme to handle the views (and controller/helper patches) for the growing number of mods I'm using rather than to continue manually hacking files under &lt;span class="fix"&gt;themes/azure&lt;/span&gt; and &lt;span class="fix"&gt;app&lt;/span&gt;. This should be here before long.&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;Several Typo themes have nice DHTML effects and I thought it would be useful to extract some of these for use in other themes. In particular I am interested in adding &lt;a href="http://www.typogarden.org/articles/2005/11/16/modernist-theme"&gt;Modernist&lt;/a&gt;'s DHTML &lt;a href="http://script.aculo.us"&gt;Scriptaculous&lt;/a&gt; ScrollTo article slider to my modded Azure theme. You can see this in action at &lt;a href="http://poocs.net"&gt;poocs.net&lt;/a&gt; which is currently running Modernist. This article covers the steps necessary to repurpose the DHTML article slider and involves templates, CSS and images. I've shown how Modernist does it and, where applicable, how I prefer to do it. It turns out to be pretty easy.&lt;/p&gt;

&lt;p&gt;I've added this feature to my test system, however it's not here yet because I've decided to create a custom Dev411_Azure theme to handle the views (and controller/helper patches) for the growing number of mods I'm using rather than to continue manually hacking files under &lt;span class="fix"&gt;themes/azure&lt;/span&gt; and &lt;span class="fix"&gt;app&lt;/span&gt;. This should be here before long.&lt;/p&gt;

&lt;p&gt;The things discussed here are the changes necessary to add the DHTML slider to a theme of your choice. For the files below the path part &lt;span class="fix"&gt;...&lt;/span&gt; should be along the lines of &lt;span class="fix"&gt;"themes/#{mytheme}"&lt;/span&gt; but can be simply &lt;span class="fix"&gt;app&lt;/span&gt; if you don't mind losing your changes when the admin console is used to change themes.&lt;/p&gt;

&lt;p&gt;I'll show where my preferences deviate from Modernist's implementation. My pet peeve is the use of the extra &lt;span class="fix"&gt;@ta&lt;/span&gt; instance varaible since it's unnecessary and the name isn't self-explanatory. I'll use &lt;span class="fix"&gt;each_with_index&lt;/span&gt; with &lt;span class="fix"&gt;article_index&lt;/span&gt; as the index name.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.../views/articles/index.rhtml&lt;/strong&gt;: in order to know the which article is next, Modernist introduces a counter called &lt;span class="fix"&gt;@ta&lt;/span&gt; in the &lt;span class="fix"&gt;index.rhtml&lt;/span&gt; file. I'll probably name this something more intuitive like &lt;span class="fix"&gt;@article_index&lt;/span&gt; but here's the code from:
&lt;span class="fix"&gt;themes/modernist/views/articles/index.rhtml&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Modernist:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;span class="highlight"&gt;&amp;lt;% @ta=0 %&amp;gt;&lt;/span&gt;
&amp;lt;% for article in @articles -%&amp;gt;
  &amp;lt;%= render_partial "article", article %&amp;gt;
  &lt;span class="highlight"&gt;&amp;lt;% @ta+=1 %&amp;gt;&lt;/span&gt;
&amp;lt;% end -%&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;My preference:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;span class="highlight"&gt;&amp;lt;% @articles.each_with_index do |article,article_index| -%&amp;gt;&lt;/span&gt;
  &amp;lt;%= render :partial =&amp;gt; "article",
             :object  =&amp;gt; article,
             :locals  =&amp;gt; { &lt;span class="highlight"&gt;:article_index =&amp;gt; article_index&lt;/span&gt; }
  %&amp;gt;
&amp;lt;% end -%&amp;gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;use &lt;span class="fix"&gt;each_with_index&lt;/span&gt; instead of creating an extra counter since the index is already available&lt;/il&gt;
&lt;li&gt;use &lt;span class="fix"&gt;render&lt;/span&gt; instead of &lt;span class="fix"&gt;render_partial&lt;/span&gt; just because the former was indicated as preferred on the &lt;span class="fix"&gt;#typo&lt;/span&gt; channel&lt;/li&gt;
&lt;li&gt;use self-explanatory variable names: &lt;span class="fix"&gt;article_index&lt;/span&gt; instead of &lt;span class="fix"&gt;ta&lt;/span&gt;
&lt;li&gt;&lt;p&gt;I would actually prefer to send the article object to the render method as a local variable since that's what it seems to be and I don't see a reason to treat it differently.&lt;/p&gt;

&lt;pre&gt;:locals =&gt; {
    :article =&gt; article
    :article_index =&gt; article_index
}&lt;/pre&gt;

&lt;p&gt;instead of as &lt;span class="fix"&gt;:object&lt;/span&gt; but I can't be sure that will always work since &lt;span class="fix"&gt;article&lt;/span&gt; is also the name of the template and there's some magic there.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;.../views/articles/_article.rhtml&lt;/strong&gt;: there are two pertinent changes in this file: (a) the Scriptaculous &lt;span class="fix"&gt;ScrollTo &lt;/span&gt; controls and (b) adding a DOM &lt;span class="fix"&gt;id&lt;/span&gt; to the article header that can be navigated to.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ScrollTo controls&lt;/strong&gt;: In the Modernist theme, the Scriptaculous controls are embedded directly in &lt;span class="fix"&gt;_article.rhtml&lt;/span&gt; as follows. Another option is to put it in a separate &lt;span class="fix"&gt;_article_flip.rhtml&lt;/span&gt; template include but I'm not sure if this will be automatically copied in by Typo's theme admin manager. In any event, the following should be added to the top of &lt;span class="fix"&gt;_article.rhtml&lt;/span&gt; either directly or as an include. Notice the innerHTML of the links below is a space. The links will be rendered as graphics once the CSS is enabled.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modernist:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&amp;lt;div class="flip"&amp;gt;
&amp;lt;a href="#header" onclick="new Effect.ScrollTo('header'); 
  return false" class="flip-top"
  title="Scroll to the top"&amp;gt; &amp;lt;/a&amp;gt;
&amp;lt;% if &lt;span class="highlight"&gt;@ta&lt;/span&gt; &amp;lt; (@articles.size-1) %&amp;gt;
&amp;lt;a href="#post-&amp;lt;%= &lt;span class="highlight"&gt;@ta&lt;/span&gt;+1 %&amp;gt;"
  onclick="new Effect.ScrollTo('post-&amp;lt;%= &lt;span class="highlight"&gt;@ta&lt;/span&gt;+1 %&amp;gt;');
  return false" class="flip-next"
  title="Scroll to the next post"&amp;gt; &amp;lt;/a&amp;gt;
&amp;lt;% end %&amp;gt;
&amp;lt;a href="#menu" onclick="new Effect.ScrollTo('menu');
  return false" class="flip-menu"
  title="Scroll to the menu"&amp;gt; &amp;lt;/a&amp;gt;
&amp;lt;/div&amp;gt;&lt;/pre&gt;

&lt;p&gt;The Modernist theme places the menu at the bottom of the page so having a control go to &lt;span class="fix"&gt;menu&lt;/span&gt; makes sense. For a more traditional theme like Azure, I added a &lt;span class="fix"&gt;&amp;lt;div id="bottom"&amp;gt;&lt;/span&gt; around &lt;span class="fix"&gt;&amp;lt;p id="pagination"&lt;/span&gt; to indicate the bottom and changed the last link above accordingly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My preference:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;Change the &lt;span class="fix"&gt;@ta&lt;/span&gt; references to &lt;span class="fix"&gt;article_index&lt;/span&gt; as above&lt;/li&gt;&lt;/ul&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;article anchor&lt;/strong&gt;: The next change is to add a DOM &lt;span class="fix"&gt;id&lt;/span&gt; with the article index to each article's title:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modernist:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&amp;lt;h3&lt;span class="highlight"&gt; id="post-&amp;lt;%= @ta %&amp;gt;"&lt;/span&gt;&amp;gt;
  &amp;lt;%= article_link article.title, article %&amp;gt;
  &amp;lt;%= author_link(article) %&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;My preference:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&amp;lt;h3&lt;span class="highlight"&gt; id="post-&amp;lt;%= article_index %&amp;gt;"&lt;/span&gt;&amp;gt;&lt;/pre&gt;


&lt;/ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CSS&lt;/strong&gt;: Copy the CSS definitions that begin with &lt;span class="fix"&gt;.flip&lt;/span&gt; to one of your CSS files:&lt;/p&gt;

&lt;pre&gt;.flip {
        float: left;
        position: absolute;
        opacity: 0.9;
        margin: 0 0 0 -65px;
}

.flip a {
        display: block;
        width: 25px;
        height: 16px;
        padding: 4px;
        background-position: center center;
        background-repeat: no-repeat;
}

.flip-menu { background-image:
  url('/images/theme/flip-bottom-0.gif'); }
.flip-next { background-image:
  url('/images/theme/flip-down-0.gif'); }
.flip-top { background-image:
  url('/images/theme/flip-top-0.gif'); }
.flip-comments { background-image:
  url('/images/theme/flip-comments-0.gif'); }
.flip-post { background-image:
  url('/images/theme/flip-post-0.gif'); }
.flip-menu:hover { background-image:
  url('/images/theme/flip-bottom-1.gif'); }
.flip-next:hover { background-image:
  url('/images/theme/flip-down-1.gif'); }
.flip-top:hover { background-image:
  url('/images/theme/flip-top-1.gif'); }
.flip-comments:hover { background-image:
  url('/images/theme/flip-comments-1.gif'); }
.flip-post:hover { background-image:
  url('/images/theme/flip-post-1.gif'); }&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;control images&lt;/strong&gt;: the last step is to copy the control images to the right location. These are the &lt;span class="fix"&gt;flip-post-[01].gif&lt;/span&gt; images referenced in the CSS. Copy these to the correct directory.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it, you should be able to get up and running.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:f8eb6729387946291159948cb9e9cc7b</id>
    <published>2006-07-02T21:37:00-05:00</published>
    <updated>2007-06-16T12:30:22-05:00</updated>
    <title type="html">Moving Day - Blogger to Typo</title>
    <link href="http://www.dev411.com/blog/2006/07/02/moving-day-blogger-to-typo" rel="alternate" type="text/html"/>
    <category term="blogger" scheme="http://www.dev411.com/blog/tag/blogger" label="blogger"/>
    <category term="typo" scheme="http://www.dev411.com/blog/tag/typo" label="typo"/>
    <category term="hacks" scheme="http://www.dev411.com/blog/tag/hacks" label="hacks"/>
    <summary type="html">&lt;p&gt;I've been experimenting with Typo at &lt;a href="http://www.dev411.com/blog/"&gt;the new Dev411 blog&lt;/a&gt; primarily to get around the serious performance problems I (and many others) have experienced on Blogger. I know they are working on this and I hope they get it under control soon, however I didn't want to wait for something that may or may not happen so I've moved everything over to &lt;a href="http://www.dev411.com/blog/"&gt;http://www.dev411.com/blog/&lt;/a&gt;. Typo has some nice features include categories/tags and Live Search which shows you search results as you type. Of course, I may switch back to Blogger (or to another engine) at some point but I'm hoping I won't have to change again.&lt;/p&gt;

&lt;p&gt;I'm running 2.6.0 which is the current stable version according to the website though many people are running code directly from the SVN trunk. I'll probably wait for 4.0 before upgrading which I've heard should be coming out soon. In the mean time I've made some changes from the default configuration:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;added table of contents to pages with multiple articles (index, category/tag, archives and search) &lt;a href="/blog/2006/06/26/adding-a-toc-to-typo"&gt;described previously&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;renamed categories to tags. The trunk supports both categories and tags but 2.6.0 only has categories. I simply renamed categories to tags by editing &lt;span class="fix"&gt;routes.rb&lt;/span&gt; and &lt;span class="fix"&gt;content.rhtml&lt;/span&gt; for the category plugin. When 4.0 comes out, I'll use the separate categories and tags and the tag uris will stay the same.&lt;/li&gt;
&lt;li&gt;moved categories/tags from bottom of each post to top by editing &lt;span class="fix"&gt;articles_helper.rb&lt;/span&gt; and templates.&lt;/li&gt;
&lt;li&gt;removed &lt;span class="fix"&gt;articles&lt;/span&gt; from uri by editing &lt;span class="fix"&gt;routes.rb&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;added number of comments to Live Search AJAX results by editing &lt;span class="fix"&gt;views/live/search.rhtml.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;added blog name to HTML title for individual article pages by editing &lt;span class="fix"&gt;articles_controller.rb&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;added Blog Roll sidebar which is just a copy of the static sidebar plugin. It would be nice if you could use the same static plugin multiple times but copy/rename is easy enough.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Features I'd like to add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigation breadcrumbs&lt;/li&gt;
&lt;li&gt;More specific HTML page titles&lt;/li&gt;
&lt;li&gt;The anchor slider from the Modernist theme&lt;/li&gt;
&lt;li&gt;A logarithmic tag cloud; the trunk version is linear&lt;/li&gt;
&lt;li&gt;Ability to categorize tags similar to del.icio.us tag bundles; this is supposed to be doable now with &lt;span class="fix"&gt;acts_as_taggable&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;A tag list that also has links to tags you use at del.icio.us and possibly other places&lt;/li&gt;
&lt;/ul&gt;</summary>
    <content type="html">&lt;p&gt;I've been experimenting with Typo at &lt;a href="http://www.dev411.com/blog/"&gt;the new Dev411 blog&lt;/a&gt; primarily to get around the serious performance problems I (and many others) have experienced on Blogger. I know they are working on this and I hope they get it under control soon, however I didn't want to wait for something that may or may not happen so I've moved everything over to &lt;a href="http://www.dev411.com/blog/"&gt;http://www.dev411.com/blog/&lt;/a&gt;. Typo has some nice features include categories/tags and Live Search which shows you search results as you type. Of course, I may switch back to Blogger (or to another engine) at some point but I'm hoping I won't have to change again.&lt;/p&gt;

&lt;p&gt;I'm running 2.6.0 which is the current stable version according to the website though many people are running code directly from the SVN trunk. I'll probably wait for 4.0 before upgrading which I've heard should be coming out soon. In the mean time I've made some changes from the default configuration:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;added table of contents to pages with multiple articles (index, category/tag, archives and search) &lt;a href="/blog/2006/06/26/adding-a-toc-to-typo"&gt;described previously&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;renamed categories to tags. The trunk supports both categories and tags but 2.6.0 only has categories. I simply renamed categories to tags by editing &lt;span class="fix"&gt;routes.rb&lt;/span&gt; and &lt;span class="fix"&gt;content.rhtml&lt;/span&gt; for the category plugin. When 4.0 comes out, I'll use the separate categories and tags and the tag uris will stay the same.&lt;/li&gt;
&lt;li&gt;moved categories/tags from bottom of each post to top by editing &lt;span class="fix"&gt;articles_helper.rb&lt;/span&gt; and templates.&lt;/li&gt;
&lt;li&gt;removed &lt;span class="fix"&gt;articles&lt;/span&gt; from uri by editing &lt;span class="fix"&gt;routes.rb&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;added number of comments to Live Search AJAX results by editing &lt;span class="fix"&gt;views/live/search.rhtml.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;added blog name to HTML title for individual article pages by editing &lt;span class="fix"&gt;articles_controller.rb&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;added Blog Roll sidebar which is just a copy of the static sidebar plugin. It would be nice if you could use the same static plugin multiple times but copy/rename is easy enough.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Features I'd like to add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigation breadcrumbs&lt;/li&gt;
&lt;li&gt;More specific HTML page titles&lt;/li&gt;
&lt;li&gt;The anchor slider from the Modernist theme&lt;/li&gt;
&lt;li&gt;A logarithmic tag cloud; the trunk version is linear&lt;/li&gt;
&lt;li&gt;Ability to categorize tags similar to del.icio.us tag bundles; this is supposed to be doable now with &lt;span class="fix"&gt;acts_as_taggable&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;A tag list that also has links to tags you use at del.icio.us and possibly other places&lt;/li&gt;
&lt;/ul&gt;

</content>
  </entry>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:1fad5773efca314b216a68fd5abe5645</id>
    <published>2006-06-26T16:37:00-05:00</published>
    <updated>2007-06-17T01:51:15-05:00</updated>
    <title type="html">Adding a TOC to Typo</title>
    <link href="http://www.dev411.com/blog/2006/06/26/adding-a-toc-to-typo" rel="alternate" type="text/html"/>
    <category term="typo" scheme="http://www.dev411.com/blog/tag/typo" label="typo"/>
    <category term="hacks" scheme="http://www.dev411.com/blog/tag/hacks" label="hacks"/>
    <category term="rails" scheme="http://www.dev411.com/blog/tag/rails" label="rails"/>
    <summary type="html">&lt;p&gt;I've been using MediaWiki for a while and wanted its ability to auto-generate Table of contents for pages with multiple articles such as the homepage and the category pages. Typo is a Ruby on Rails app so you'll need to be somewhat familiar with it to make enhancments. I have this running on Typo 4.1.1, 4.0.0 r1188 and 2.6.0.&lt;/p&gt;

&lt;p&gt;I came up with the following but it's still in the early stages:&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;I've been using MediaWiki for a while and wanted its ability to auto-generate Table of contents for pages with multiple articles such as the homepage and the category pages. Typo is a Ruby on Rails app so you'll need to be somewhat familiar with it to make enhancments. I have this running on Typo 4.1.1, 4.0.0 r1188 and 2.6.0.&lt;/p&gt;

&lt;p&gt;I came up with the following but it's still in the early stages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Add name attribute to article links:&lt;/strong&gt; We want to add the HTML name attribute to the article links so we can anchor to them. To do this, edit the &lt;span class="fix"&gt;app/helpers/application_helper.rb&lt;/span&gt; file and modify the appropriate method shown below with the changes in highlighted.&lt;/p&gt;

&lt;p&gt;For Typo 4.1.1:&lt;/p&gt;
&lt;pre&gt;def link_to_permalink(item, title, anchor=nil&lt;span class="highlight"&gt;, name=nil&lt;/span&gt;)
  anchor = "##{anchor}" if anchor
  &lt;span class="highlight"&gt;name   = " name=\"#{name}\"" if name&lt;/span&gt;
  "&amp;lt;a href=\"#{item.permalink_url}#{anchor}\"&lt;span class="highlight"&gt;#{name}&lt;/span&gt;&amp;gt;#{title}&amp;lt;/a&amp;gt;"
end&lt;/pre&gt;

&lt;p&gt;For Typo 4.0.0:&lt;/p&gt;
&lt;pre&gt;def item_link(title, item, anchor=nil)
  &lt;span class="highlight"&gt;if item.is_a?(Article) &amp;amp;&amp;amp; anchor != 'comments'&lt;/span&gt;
  &lt;span class="highlight"&gt;&amp;amp;&amp;amp; anchor != 'trackbacks'&lt;/span&gt;
    &lt;span class="highlight"&gt;link_to title, item.location(anchor), :name =&gt; item.id&lt;/span&gt;
  &lt;span class="highlight"&gt;else&lt;/span&gt;
    link_to title, item.location(anchor)
  &lt;span class="highlight"&gt;end&lt;/span&gt;
end&lt;/pre&gt;

&lt;p&gt;For Typo 2.6.0:&lt;/p&gt;
&lt;pre&gt;def article_link(title, article, anchor=nil)
  link_to title, article_url(article,true,anchor),
    &lt;span class="highlight"&gt;:name =&amp;gt; article.id&lt;/span&gt;
end&lt;/pre&gt;

&lt;p&gt;For Typo 4.1.1, you will also need to edit the &lt;span class="fix"&gt;app/views/articles/index.rhtml&lt;/span&gt; file and make the following modification:&lt;/p&gt;

&lt;pre&gt;&amp;lt;%= link_to_permalink article,article.title&lt;span class="highlight"&gt;,nil,article.id&lt;/span&gt; %&amp;gt;&lt;/pre&gt;

&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Add TOC template:&lt;/strong&gt; I decided to create a separate template to handle the TOC. I used the following file name:&lt;/p&gt;

&lt;p&gt;&lt;span class="fix"&gt;app/views/articles/_articles_toc.rhtml&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;which consists of the following (I didn't use &lt;span class="fix"&gt;link_to&lt;/span&gt; because the uri is only the &lt;span class="fix"&gt;article.id&lt;/span&gt;):&lt;/p&gt;
&lt;pre&gt;
&amp;lt;div id="articles_toc"&amp;gt;&amp;lt;p&amp;gt;Table of Contents&amp;lt;/p&amp;gt;
  &amp;lt;ul&amp;gt;
  &amp;lt;% for article in @articles -%&amp;gt;
    &amp;lt;li&amp;gt;
      &amp;lt;a href="#&amp;lt;%= article.id %&amp;gt;"&amp;gt;
        &amp;lt;%= article.title %&amp;gt;
      &amp;lt;/a&amp;gt;
    &amp;lt;/li&amp;gt;
  &amp;lt;% end -%&amp;gt;
  &amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Call the TOC template:&lt;/strong&gt; To call the TOC template from &lt;span class="fix"&gt;index.rhtml&lt;/span&gt;, add the following at the top of &lt;span class="fix"&gt;app/views/articles/index.rhtml&lt;/span&gt;&lt;!--I tried to pass the articles object but it wasn't working; I'll look at it again in a bit.--&gt;&lt;/p&gt;
&lt;pre&gt;&amp;lt;%= render_partial "articles_toc" %&amp;gt;&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;&lt;strong&gt;Style with CSS:&lt;/strong&gt; You'll probably want to style the TOC using CSS. Since the TOC feature is a hack it may be easier to put it in a supplementary CSS file so it won't get overwritten when you switch themes.&lt;/li&gt;

&lt;li&gt;&lt;strong&gt;TODO - Admin Console:&lt;/strong&gt; To make this a full-fledged enhancement, there should be a toggle in the admin console to turn the TOC on and off. Right now this also shows the list for the index and category pages even when there's just one article on the page. It may be worthwhile to configure a mininum number of articles before the TOC is displayed.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I'll run this on this blog for now since I like having a quick way to see the list of articles on the page.&lt;/p&gt;

&lt;p&gt;UPDATE 1: I added the number of comments to the existing TOC here. You can get the number of comments by using &lt;span class="fix"&gt;article.comments.length&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;UPDATE 2: I also looked at turning this into a sidebar plugin by using the bundled 2.6.0 plugins as examples. It seems that the sidebars are components and have their own context so they may not be able to access &lt;span class="fix"&gt;@articles&lt;/span&gt; in the action context. I'll either have to query articles a second time, which I'm loathe to do, or write it in JS and then do a JS sidebar rendering. It would be nice if the sidebar shared or could access the primary context.&lt;/p&gt;

&lt;p&gt;UPDATE 2.1: After looking at &lt;span class="fix"&gt;layouts/default.rhtml&lt;/span&gt; I think it may be possible to pass &lt;span class="fix"&gt;@articles&lt;/span&gt; to the sidebar by adding it to:&lt;/p&gt;
&lt;pre&gt;&amp;lt;%= render_component(:controller=&gt;'sidebars/sidebar'&lt;/pre&gt; 
&lt;p&gt;&lt;span class="fix"&gt;default.rhtml&lt;/span&gt; gets &lt;span class="fix"&gt;@content_for_layout&lt;/span&gt;, not &lt;span class="fix"&gt;@articles&lt;/span&gt;, so some testing is needed.&lt;/p&gt;

&lt;p&gt;UPDATE 3: I was running the Lucid theme here before but I had problems with anchors in that articles and sidebar content above the selected anchor wouldn't render when an anchor was selected. I've switched back to Azure for now.&lt;/p&gt;</content>
  </entry>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:c833628f9d4aab957f04be622ff90199</id>
    <published>2006-06-13T21:52:00-05:00</published>
    <updated>2007-06-16T12:30:22-05:00</updated>
    <title type="html">Python - First Impressions from Hacking PlanetPlanet</title>
    <link href="http://www.dev411.com/blog/2006/06/13/python-first-impressions-hacking-planetplanet" rel="alternate" type="text/html"/>
    <category term="python" scheme="http://www.dev411.com/blog/tag/python" label="python"/>
    <category term="planet" scheme="http://www.dev411.com/blog/tag/planet" label="planet"/>
    <category term="hacks" scheme="http://www.dev411.com/blog/tag/hacks" label="hacks"/>
    <summary type="html">&lt;p&gt;Over the weekend I got to use Python for the first time to add channel categories to &lt;a href="http://www.planetplanet.org/"&gt;Planet&lt;/a&gt; which can be seen in action at &lt;a href="http://www.planetmvc.org"&gt;Planet MVC&lt;/a&gt;. My first impressions of Python is that the resulting code looks very clean. The syntax was also easy to pick up primarily due to the excellent docs site and because it reminded me of JavaScript.&lt;/p&gt;

&lt;p&gt;The first problem I ran into was using the regex object's &lt;span class="fix"&gt;re.match&lt;/span&gt; which definately does not follow the Python philosophy of "&lt;a href="http://www.python.org/dev/culture.html"&gt;There should be one -- and preferably only one -- obvious way to do it&lt;/a&gt;" because there's more than one way and &lt;span class="fix"&gt;re.match&lt;/span&gt; is not obvious because it works different than other languages. Python's &lt;span class="fix"&gt;re.match&lt;/span&gt; automatically starts from the begining of the string unlike regex engines for other languages (grep|sed|awk|perl|ruby). This results in the following behavior:&lt;/p&gt;

&lt;pre&gt;# matches - pattern is at start of string
m = re.match('b', 'bc')

# does not match - pattern is not at start of string
m = re.match('b', 'abc')

# matches - add the .* to match any leading characters
# but .* isn't needed after '.*b' to match 'c'
m = re.match('.*b', 'abc')

# matches - second .* matches 'c' but isn't needed
m = re.match('.*b.*', 'abc')&lt;/pre&gt;

&lt;p&gt;I was sticking to &lt;span class="fix"&gt;re.match&lt;/span&gt; because I needed the &lt;span class="fix"&gt;MatchObject&lt;/span&gt; to capture groups but it didn't DWIW. After posting to a forum, I learned that I should use &lt;span class="fix"&gt;re.search&lt;/span&gt; instead which will match anywhere in the string. &lt;span class="fix"&gt;re.search&lt;/span&gt; also returns a &lt;span class="fix"&gt;MatchObject&lt;/span&gt; but I didn't expect this at first because search != match. I get the impression &lt;span class="fix"&gt;re.match&lt;/span&gt; and &lt;span class="fix"&gt;MatchObject&lt;/span&gt; were created first and &lt;span class="fix"&gt;re.search&lt;/span&gt; was added later. Perhaps the &lt;span class="fix"&gt;MatchObject&lt;/span&gt; should be called something generic, like &lt;span class="fix"&gt;ResultObject&lt;/span&gt;, in the docs. I'm sort of curious but when is &lt;span class="fix"&gt;re.match&lt;/span&gt; desired over &lt;span class="fix"&gt;re.search&lt;/span&gt;? It seems like &lt;span class="fix"&gt;re.match&lt;/span&gt; is useful only in a limited number of situations and then it's always easy to implement it with &lt;span class="fix"&gt;re.search&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;The open issue for me is Python's dependency on indenting. Lately I've been using tabs exclusively for indentation because I like to see the tickmarks may editors show for tabs. This lets me quickly know what level I'm at. This &lt;a href="http://mail.python.org/pipermail/python-list/2004-July/228199.html"&gt;python-list thread&lt;/a&gt; was titled Tab Wars and argued in favor of spaces over tabs. Planet is indented with spaces and that's what I used for my hacking. Given my preference for tabs, the more time I spend with Python the more likely I'll switch to tabs. Do I need to convert the entire script to tabs or can I mix tabs with spaces? What do people with a preference for tabs do with Python code that uses spaces?&lt;/p&gt;

&lt;p&gt;I've been thinking about releasing my enhanced version of PlanetPlanet which allows one planet site to run multiple planets but now I'm thinking I want to do more enhancements to make it even more user friendly. Let me know how &lt;a href="http://www.planetmvc.org"&gt;Planet MVC&lt;/a&gt; is working for you or if I can add any additional blogs. I've already found it pretty useful to find out about things I otherwise wouldn't have.&lt;/p&gt;

&lt;p&gt;Here are &lt;a href="http://www.dev411.com/wiki/PlanetPlanet"&gt;some notes on getting Planet running&lt;/a&gt;.&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;Over the weekend I got to use Python for the first time to add channel categories to &lt;a href="http://www.planetplanet.org/"&gt;Planet&lt;/a&gt; which can be seen in action at &lt;a href="http://www.planetmvc.org"&gt;Planet MVC&lt;/a&gt;. My first impressions of Python is that the resulting code looks very clean. The syntax was also easy to pick up primarily due to the excellent docs site and because it reminded me of JavaScript.&lt;/p&gt;

&lt;p&gt;The first problem I ran into was using the regex object's &lt;span class="fix"&gt;re.match&lt;/span&gt; which definately does not follow the Python philosophy of "&lt;a href="http://www.python.org/dev/culture.html"&gt;There should be one -- and preferably only one -- obvious way to do it&lt;/a&gt;" because there's more than one way and &lt;span class="fix"&gt;re.match&lt;/span&gt; is not obvious because it works different than other languages. Python's &lt;span class="fix"&gt;re.match&lt;/span&gt; automatically starts from the begining of the string unlike regex engines for other languages (grep|sed|awk|perl|ruby). This results in the following behavior:&lt;/p&gt;

&lt;pre&gt;# matches - pattern is at start of string
m = re.match('b', 'bc')

# does not match - pattern is not at start of string
m = re.match('b', 'abc')

# matches - add the .* to match any leading characters
# but .* isn't needed after '.*b' to match 'c'
m = re.match('.*b', 'abc')

# matches - second .* matches 'c' but isn't needed
m = re.match('.*b.*', 'abc')&lt;/pre&gt;

&lt;p&gt;I was sticking to &lt;span class="fix"&gt;re.match&lt;/span&gt; because I needed the &lt;span class="fix"&gt;MatchObject&lt;/span&gt; to capture groups but it didn't DWIW. After posting to a forum, I learned that I should use &lt;span class="fix"&gt;re.search&lt;/span&gt; instead which will match anywhere in the string. &lt;span class="fix"&gt;re.search&lt;/span&gt; also returns a &lt;span class="fix"&gt;MatchObject&lt;/span&gt; but I didn't expect this at first because search != match. I get the impression &lt;span class="fix"&gt;re.match&lt;/span&gt; and &lt;span class="fix"&gt;MatchObject&lt;/span&gt; were created first and &lt;span class="fix"&gt;re.search&lt;/span&gt; was added later. Perhaps the &lt;span class="fix"&gt;MatchObject&lt;/span&gt; should be called something generic, like &lt;span class="fix"&gt;ResultObject&lt;/span&gt;, in the docs. I'm sort of curious but when is &lt;span class="fix"&gt;re.match&lt;/span&gt; desired over &lt;span class="fix"&gt;re.search&lt;/span&gt;? It seems like &lt;span class="fix"&gt;re.match&lt;/span&gt; is useful only in a limited number of situations and then it's always easy to implement it with &lt;span class="fix"&gt;re.search&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;The open issue for me is Python's dependency on indenting. Lately I've been using tabs exclusively for indentation because I like to see the tickmarks may editors show for tabs. This lets me quickly know what level I'm at. This &lt;a href="http://mail.python.org/pipermail/python-list/2004-July/228199.html"&gt;python-list thread&lt;/a&gt; was titled Tab Wars and argued in favor of spaces over tabs. Planet is indented with spaces and that's what I used for my hacking. Given my preference for tabs, the more time I spend with Python the more likely I'll switch to tabs. Do I need to convert the entire script to tabs or can I mix tabs with spaces? What do people with a preference for tabs do with Python code that uses spaces?&lt;/p&gt;

&lt;p&gt;I've been thinking about releasing my enhanced version of PlanetPlanet which allows one planet site to run multiple planets but now I'm thinking I want to do more enhancements to make it even more user friendly. Let me know how &lt;a href="http://www.planetmvc.org"&gt;Planet MVC&lt;/a&gt; is working for you or if I can add any additional blogs. I've already found it pretty useful to find out about things I otherwise wouldn't have.&lt;/p&gt;

&lt;p&gt;Here are &lt;a href="http://www.dev411.com/wiki/PlanetPlanet"&gt;some notes on getting Planet running&lt;/a&gt;.&lt;/p&gt;

</content>
  </entry>
</feed>

