Sponsors

Google AdSense Section Targetting

Posted by Darshan Patil Thu, 14 Sep 2006 03:19:00 GMT

After wading through the google documentation I finally found out why the adsense ads on my blog don’t match the content.

The relevant document

What it says is, you can tag your HTML content
  • to emphasize or
  • to ignore regions.

Aha. So what that meant was my sidebar was screwing google’s keyword selector resulting in sub-optimal ads. Armed with that knowledge, I quickly hacked my typo install to have google ignore sidebar content.

The tags

To emphasize:

<!--google_ad_section_start-->
<!--google_ad_section_end-->

To ignore:

<!-- google_ad_section_start(weight=ignore) -->
<!-- google_ad_section_end -->

The change to typo:

cd typodir/themes/mytheme/layouts/
Edit the default.rhtml file so that you put the ignore comments from above around the sidebar rendering. Your default.rhtml should look like
...
<!-- google_ad_section_start(weight=ignore) -->
<%= render_sidebars %>
<!-- google_ad_section_end(weight=ignore) -->
...

Typo: Recent articles sidebar 2

Posted by Darshan Patil Sun, 10 Sep 2006 21:24:00 GMT

I wanted a recent articles sidebar on my blog so users would be able to click on articles from the sidebar without having to navigate too much. You can see it in action on the sidebar right now. I could not find one so I quickly hacked one together. I can’t tell you how incredibly easy it was to do this. I had one ready in about 20 minutes after wanting one. Now that is what I call rapid development. Ruby on rails rocks !

You can download it here

To install
cd yourtypodir/components/plugins/sidebars/
wget http://scattrbrain.com/files/recentarticles.tgz
tar -zxvf recentarticles.tgz
rm recentarticles.tgz
typo restart yourtypodir

Once that is done, you can go to the admin section of your blog and choose the recent articles sidebar.

Tweaking typo for your needs 4

Posted by Darshan Patil Sat, 09 Sep 2006 03:08:00 GMT

Installing themes

Find a theme you like at http://www.dev411.com/typo/themes/
Once that is done, make sure the theme is supported/tested for the version of typo you are running. Download it to the themes directory in your typo install. So if typo is installed in ~/typo/ and you want to install the Phokus theme which in my opinion rocks, you would do the following:

cd ~/typo/
wget http://proofread.digital-achievement.com/downloads/4.0.0/phokus.tgz
tar -zxvf phokus.tgz

Once that is done you can see the theme under themes in www.yourblog.com/admin

Adding Google Analytics support

Once you have your google analytics account setup, you get a snippet of html that you need to include in all your pages. This normally looks like:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-888888-8";
urchinTracker();
</script>

To add this to all pages in your blog installed in ~/typo, you would do:

cd ~/typo/app/helpers/

You need to edit articles_helper.rb in that directory. Find "def page_header" Insert the snippet just before the line which says HTML.

page_header should look like:

def page_header
    page_header_includes = contents.collect { |c| c.whiteboard }.collect { |w| w
.select {|k,v| k =~ /^page_header_/}.collect {|(k,v)| v} }.flatten.uniq
    (
    <<-HTML
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
     #{ meta_tag 'ICBM', this_blog.geourl_location unless this_blog.geourl_location
.empty? }
     <link rel="EditURI" type="application/rsd+xml" title="RSD" href="#{ server_url
_for :controller => 'xml', :action => 'rsd' }" />
     <link rel="alternate" type="application/atom+xml" title="Atom" href="#{ @auto_
discovery_url_atom }" />
     <link rel="alternate" type="application/rss+xml" title="RSS" href="#{ @auto_di
scovery_url_rss }" />
     #{ javascript_include_tag "cookies" }
     #{ javascript_include_tag "prototype" }
     #{ javascript_include_tag "effects" }
     #{ javascript_include_tag "typo" }
     #{ page_header_includes.join("\n") }
     <script type="text/javascript">#{ @content_for_script }</script>
     <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
     </script>
     <script type="text/javascript">
     _uacct = "UA-888888-8";
     urchinTracker();
     </script>
    HTML
    ).chomp
  end
Restart typo by typing:
 typo restart ~/typo/ 
and you’re ready to go

Older posts: 1 2