<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Harry Love &#187; Google</title>
	<atom:link href="http://harrylove.org/tags/google/feed" rel="self" type="application/rss+xml" />
	<link>http://harrylove.org</link>
	<description>Neat wheelie, Mrs. Schmouse, don't lose it!</description>
	<lastBuildDate>Thu, 25 Jun 2009 05:22:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Embed Google Route Maps of Your Flights into Your Web Site</title>
		<link>http://harrylove.org/2008/07/30/embed-google-route-maps-of-your-flights-into-your-web-site.html</link>
		<comments>http://harrylove.org/2008/07/30/embed-google-route-maps-of-your-flights-into-your-web-site.html#comments</comments>
		<pubDate>Thu, 31 Jul 2008 01:56:43 +0000</pubDate>
		<dc:creator>Harry Love</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[aviation]]></category>
		<category><![CDATA[flying]]></category>
		<category><![CDATA[Google maps]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[routes]]></category>
		<category><![CDATA[trips]]></category>

		<guid isPermaLink="false">http://harrylove.org/?p=432</guid>
		<description><![CDATA[Do me a favor. Paste this URL into your browser&#8217;s address bar:
http://jetrecord.com/routes/sea+jfk
And now paste this one:
http://jetrecord.com/routes/sea+jfk.map?width=450&#38;height=300
Oh, yes, my friend! You can now embed route maps from Jetrecord into your web site, assuming your web site or blog allows you to embed content using iframes or something similar. WordPress does. How do I know? Well &#8230;

Why [...]]]></description>
			<content:encoded><![CDATA[<p>Do me a favor. Paste this URL into your browser&#8217;s address bar:</p>
<p>http://jetrecord.com/routes/sea+jfk</p>
<p>And now paste this one:</p>
<p>http://jetrecord.com/routes/sea+jfk.map?width=450&amp;height=300</p>
<p>Oh, yes, my friend! You can now <a href="http://jetrecord.com/blog/2008/07/embed-route-maps-in-your-own-web-site">embed route maps from Jetrecord into your web site</a>, assuming your web site or blog allows you to embed content using iframes or something similar. WordPress does. How do I know? Well &#8230;</p>
<p><iframe style="width:100%;overflow:hidden" src="http://jetrecord.com/routes/DEN+BOS.map?width=500&#038;height=350" width="500px" height="365px" frameborder="0" marginwidth="0" marginheight="0"></iframe></p>
<p>Why would you use this? Just for fun, of course! Are you flying somewhere cool? Do you know the airport codes for your origin and destination airports? Use the URLs above as a guide. Jetrecord will create your route maps on the fly.</p>
<p>For example, the airport code for Denver International is DEN. The airport code for Boston&#8217;s Logan International is BOS. Type this into your browser&#8217;s address bar: http://jetrecord.com/routes/den+bos</p>
<p>Jetrecord will draw the map for you and create the route page. Scroll to the bottom of the route page below the Google map. There is some code listed there to embed the map. Copy the code, modify the HTML if you want to (you may want to modify the dimensions of the map and the iframe), and paste it into your web site. Or pass the URL around via email, create a link to it, whatever you feel like doing.</p>
<p>Have fun! Oh, and be sure to read the terms and conditions at the bottom of <a href="http://jetrecord.com/blog/2008/07/embed-route-maps-in-your-own-web-site">the blog post on Jetrecord</a>.</p>
<div class="center"><iframe src="http://rcm.amazon.com/e/cm?t=loveoirs-20&#038;o=1&#038;p=16&#038;l=st1&#038;mode=books&#038;search=Google%20Maps&#038;fc1=000000&#038;lt1=_blank&#038;lc1=3366FF&#038;bg1=FFFFFF&#038;f=ifr" marginwidth="0" marginheight="0" width="468" height="336" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://harrylove.org/2008/07/30/embed-google-route-maps-of-your-flights-into-your-web-site.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Sitemaps with Ruby on Rails, Capistrano, and Cron</title>
		<link>http://harrylove.org/2008/06/10/google-sitemaps-with-ruby-on-rails-capistrano-and-cron.html</link>
		<comments>http://harrylove.org/2008/06/10/google-sitemaps-with-ruby-on-rails-capistrano-and-cron.html#comments</comments>
		<pubDate>Tue, 10 Jun 2008 23:51:15 +0000</pubDate>
		<dc:creator>Harry Love</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[sitemaps]]></category>

		<guid isPermaLink="false">http://harrylove.org/?p=374</guid>
		<description><![CDATA[This is a slight modification of code originally written by Alastair Brunton. I recently implemented this for Jetrecord and since Alastair was so generous, I decided to share the love as well. I have changed Alastair&#8217;s code to generate a sitemap index file plus sitemap files for each model, all of them gzipped to save [...]]]></description>
			<content:encoded><![CDATA[<p>This is a slight modification of code <a href="http://scoop.cheerfactory.co.uk/2008/02/26/google-sitemap-generator/">originally written by Alastair Brunton</a>. I recently implemented this for <a href="http://jetrecord.com/">Jetrecord</a> and since Alastair was so generous, I decided to share the love as well. I have changed Alastair&#8217;s code to generate a sitemap index file plus sitemap files for each model, all of them gzipped to save on bandwidth.</p>
<p>I have also added Capistrano code to copy sitemap files from the previous release to the current release so we don&#8217;t lose our sitemap files when we deploy a new release.</p>
<p>Remember, Google sitemaps are for publicly available URLs. They&#8217;re for pages that you <strong>want</strong> Google to find and index. If you don&#8217;t want Google to find your CIA Operatives records, don&#8217;t tell Google about it!</p>
<p>Let&#8217;s just go straight to the code. I am going from the top down in my application&#8217;s root directory.</p>
<h2>app/models/your_model.rb</h2>
<p>You must add this code to each model that you want to generate a sitemap for. Here is an example for <a href="http://jetrecord.com/airports">Airports on Jetrecord</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># put this inside app/models/airport.rb</span>
<span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">get_paths</span>
  path_ar = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>model<span style="color:#006600; font-weight:bold;">|</span>
    path_ar <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>:url <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/airports/#{model.to_param}&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:last_mod</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> model.<span style="color:#9900CC;">updated_at</span>.<span style="color:#9900CC;">strftime</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'%Y-%m-%d'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  path_ar
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h2>config/sitemap/sitemap_tasks.rb</h2>
<p>This is for Capistrano. You probably don&#8217;t have a config/sitemap directory. I created one and put my Capistrano sitemap task in it. This tells Capistrano, &#8220;After deploying my new release, copy the sitemap files from the previous release and store them in the same location in the current release.&#8221;</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">Capistrano::Configuration</span>.<span style="color:#9900CC;">instance</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:must_exist</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0066; font-weight:bold;">load</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  namespace <span style="color:#ff3333; font-weight:bold;">:sitemap</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    desc <span style="color:#996600;">&quot;Copy the sitemap files after deploy&quot;</span>
    task <span style="color:#ff3333; font-weight:bold;">:copy_sitemap</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:app</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;copying Rails sitemap files&quot;</span>
      sudo <span style="color:#996600;">&quot;cp #{previous_release}/public/sitemaps/* #{current_release}/public/sitemaps/&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    after <span style="color:#ff3333; font-weight:bold;">:deploy</span>, <span style="color:#996600;">'sitemap:copy_sitemap'</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h2>config/deploy.rb</h2>
<p>This file usually contains your typical Capistrano recipes. All you have to do is require the sitemap_tasks file we created above.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># At the top of the file, after any other required files</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'config/sitemap/sitemap_tasks'</span></pre></div></div>

<h2>lib/google_sitemap.rb</h2>
<p>This is the meat of the whole thing. Kudos to Alastair for setting this up. The reason I modified it into using a sitemap index with sitemaps for each model is because Google allows a total of 50,000 links per sitemap. I have 48,000 navigation fixes, 20,000 airports, and 3,000 navaids in Jetrecord. By necessity I have to split my sitemap into many sitemaps.</p>
<p>I&#8217;m also gzipping the sitemap files because Google can read them and it saves bandwidth. Oh, and the URL to ping Google has changed, as has the XML namespace for their sitemap tags.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'net/http'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'uri'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># A class specific to the application which generates a google sitemap from the contents of the database.</span>
<span style="color:#008000; font-style:italic;"># Author: Alastair Brunton</span>
<span style="color:#008000; font-style:italic;"># Modified: Harry Love 2008-06-09</span>
<span style="color:#9966CC; font-weight:bold;">class</span> GoogleSitemapGenerator
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>base_url, sources<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@base_url</span> = base_url
    <span style="color:#0066ff; font-weight:bold;">@sources</span> = sources
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># 1. Iterate through each model's #get_paths method</span>
  <span style="color:#008000; font-style:italic;"># 2. Create sitemap file for each model</span>
  <span style="color:#008000; font-style:italic;"># 3. Create sitemap index file</span>
  <span style="color:#008000; font-style:italic;"># 4. Ping Google</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> generate
    path_ar = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    sitemaps = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    <span style="color:#0066ff; font-weight:bold;">@sources</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>source<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#008000; font-style:italic;"># initialize the class and call the get_paths method on it.</span>
      path_ar = <span style="color:#CC0066; font-weight:bold;">eval</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{source}.get_paths&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      xml = generate_sitemap<span style="color:#006600; font-weight:bold;">&#40;</span>path_ar<span style="color:#006600; font-weight:bold;">&#41;</span>
      save_file<span style="color:#006600; font-weight:bold;">&#40;</span>source, xml<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    index = generate_sitemap_index<span style="color:#006600; font-weight:bold;">&#40;</span>@sources<span style="color:#006600; font-weight:bold;">&#41;</span>
    save_file<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'index'</span>, index<span style="color:#006600; font-weight:bold;">&#41;</span>
    update_google
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Create a sitemap document for a model</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> generate_sitemap<span style="color:#006600; font-weight:bold;">&#40;</span>path_ar<span style="color:#006600; font-weight:bold;">&#41;</span>
    xml_str = <span style="color:#996600;">&quot;&quot;</span>
    xml = <span style="color:#6666ff; font-weight:bold;">Builder::XmlMarkup</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:target</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> xml_str<span style="color:#006600; font-weight:bold;">&#41;</span>
    xml.<span style="color:#9900CC;">instruct</span>!
    xml.<span style="color:#9900CC;">urlset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:xmlns</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'http://www.sitemaps.org/schemas/sitemap/0.9'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
      path_ar.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>path<span style="color:#006600; font-weight:bold;">|</span>
        xml.<span style="color:#9900CC;">url</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
      	  xml.<span style="color:#9900CC;">loc</span><span style="color:#006600; font-weight:bold;">&#40;</span>@base_url <span style="color:#006600; font-weight:bold;">+</span> path<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:url</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      	  xml.<span style="color:#9900CC;">lastmod</span><span style="color:#006600; font-weight:bold;">&#40;</span>path<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:last_mod</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      	  xml.<span style="color:#9900CC;">changefreq</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'weekly'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#006600; font-weight:bold;">&#125;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#006600; font-weight:bold;">&#125;</span>
    xml_str
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Create a sitemap index document</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> generate_sitemap_index<span style="color:#006600; font-weight:bold;">&#40;</span>sitemaps<span style="color:#006600; font-weight:bold;">&#41;</span>
    xml_str = <span style="color:#996600;">&quot;&quot;</span>
    xml = <span style="color:#6666ff; font-weight:bold;">Builder::XmlMarkup</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:target</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> xml_str<span style="color:#006600; font-weight:bold;">&#41;</span>
    xml.<span style="color:#9900CC;">instruct</span>!
    xml.<span style="color:#9900CC;">sitemapindex</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:xmlns</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'http://www.sitemaps.org/schemas/sitemap/0.9'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
      sitemaps.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>site<span style="color:#006600; font-weight:bold;">|</span>
        xml.<span style="color:#9900CC;">sitemap</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
      	  xml.<span style="color:#9900CC;">loc</span><span style="color:#006600; font-weight:bold;">&#40;</span>@base_url <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/sitemaps/sitemap_#{site}.xml.gz&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      	  xml.<span style="color:#9900CC;">lastmod</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">strftime</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'%Y-%m-%d'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
   	<span style="color:#006600; font-weight:bold;">&#125;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#006600; font-weight:bold;">&#125;</span>
    xml_str
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Save the xml file (gzipped) to disk</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> save_file<span style="color:#006600; font-weight:bold;">&#40;</span>source, xml<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span>RAILS_ROOT <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/public/sitemaps/sitemap_#{source}.xml.gz&quot;</span>, <span style="color:#996600;">'w+'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span>
      gz = <span style="color:#6666ff; font-weight:bold;">Zlib::GzipWriter</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>f<span style="color:#006600; font-weight:bold;">&#41;</span>
      gz.<span style="color:#9900CC;">write</span> xml
      gz.<span style="color:#9900CC;">close</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Notify Google of the new sitemap index file</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> update_google
    sitemap_uri = <span style="color:#0066ff; font-weight:bold;">@base_url</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">'/sitemaps/sitemap_index.xml.gz'</span>
    escaped_sitemap_uri = <span style="color:#CC00FF; font-weight:bold;">URI</span>.<span style="color:#9900CC;">escape</span><span style="color:#006600; font-weight:bold;">&#40;</span>sitemap_uri<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#6666ff; font-weight:bold;">Net::HTTP</span>.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'www.google.com'</span>, <span style="color:#996600;">'/webmasters/tools/ping?sitemap='</span> <span style="color:#006600; font-weight:bold;">+</span> escaped_sitemap_uri<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h2>lib/tasks/sitemap.rake</h2>
<p>This is the rake task that we&#8217;ll call periodically from Cron to generate new sitemap files.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'google_sitemap'</span>
namespace <span style="color:#ff3333; font-weight:bold;">:google_sitemap</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  desc <span style="color:#996600;">&quot;Generate a Google sitemap from the models&quot;</span>
  task<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:generate</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:environment</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#008000; font-style:italic;"># Generate sitemaps for each of the models listed in the array</span>
    sources = <span style="color:#006600; font-weight:bold;">%</span>w<span style="color:#006600; font-weight:bold;">&#40;</span> Airport Navaid Fix AnotherModel AnotherModel AndAnotherModel EtCetera <span style="color:#006600; font-weight:bold;">&#41;</span>
    sitemap = GoogleSitemapGenerator.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'http://yourdomain.com'</span>, sources<span style="color:#006600; font-weight:bold;">&#41;</span>
    sitemap.<span style="color:#9900CC;">generate</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h2>public/sitemaps</h2>
<p>Assuming this directory doesn&#8217;t exist already, create it.</p>
<p>Also, depending on what stack you&#8217;re using to deploy your Rails app, you may also need to tell your server to skip proxying HTTP requests to this directory. For example, I&#8217;m proxying requests to Mongrel via Apache. So, in the Apache virtual host conf file for my app, I had to add a ProxyPass directive so Apache would serve the sitemap files instead of Mongrel.</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;"># Right after the ProxyPass directives for images, stylesheets, and javascripts</span>
<span style="color: #00007f;">ProxyPass</span> /sitemaps !</pre></div></div>

<p>Don&#8217;t forget to restart Apache after you save the new conf file!</p>
<h2>Add a Cron Job</h2>
<p>Lastly, you need to add a cron job to call the rake task so we can generate new sitemap files from time to time. The frequency is up to you and the requirements of your app.</p>
<p>Unfortunately, I&#8217;m not up to date on raw Cron commands. I use a GUI provided by <a href="http://joyent.com/">my web host</a>. But here&#8217;s the command I&#8217;m using on Solaris to call the rake task. You&#8217;ll have to edit this to suit the specifics of your application and server environment.</p>

<div class="wp_syntax"><div class="code"><pre class="cron" style="font-family:monospace;">cd /var/www/apps/myapp/current &amp;&amp; /opt/local/bin/rake RAILS_ENV=production google_sitemap:generate</pre></div></div>

<p>Don&#8217;t forget to tell Rake to use the production environment. Another potential gotcha: you usually have to give cron the full path to rake. You can find out where it is on your server by logging in as the user you plan to use for the cron job (usually root) and doing &#8220;which rake&#8221;. If that doesn&#8217;t bring it up it means rake isn&#8217;t in your PATH. That&#8217;s okay. You&#8217;ll just have to do a little more digging to find out where rake is installed on your system.</p>
<p>If I&#8217;ve left out anything let me know. By the way, this would make a great plugin or gem, if only I knew how to make them.</p>
]]></content:encoded>
			<wfw:commentRss>http://harrylove.org/2008/06/10/google-sitemaps-with-ruby-on-rails-capistrano-and-cron.html/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Automatically Delete Spam from Gmail</title>
		<link>http://harrylove.org/2007/04/30/automatically-delete-spam-from-gmail.html</link>
		<comments>http://harrylove.org/2007/04/30/automatically-delete-spam-from-gmail.html#comments</comments>
		<pubDate>Mon, 30 Apr 2007 16:05:05 +0000</pubDate>
		<dc:creator>Harry Love</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://harrylove.org/2007/04/30/automatically-delete-spam-from-gmail</guid>
		<description><![CDATA[Gmail&#8217;s spam filter is pretty good. I get roughly one or two false positives a year. However, I think spam notification in Gmail should be redesigned. Currently, when new spam arrives, the folder link turns bold and displays a mail count. This grabs my attention.

That&#8217;s annoying. I don&#8217;t want it to grab my attention, I [...]]]></description>
			<content:encoded><![CDATA[<p>Gmail&#8217;s spam filter is pretty good. I get roughly one or two false positives a year. However, I think spam notification in Gmail should be redesigned. Currently, when new spam arrives, the folder link turns bold and displays a mail count. This grabs my attention.</p>
<p><span id="more-13"></span></p>
<p>That&#8217;s annoying. I don&#8217;t want it to grab my attention, I just want it to delete my spam. Smart, legitimate people will do everything they can to contact me in other ways if I don&#8217;t respond to their email so there&#8217;s no reason for me to scan the list of senders and subject lines.</p>
<p>With that in mind, and with a quick Google search, I stumbled upon this nifty filter trick that will automatically delete spam from Gmail&#8217;s spam folder and send it to the trash.</p>
<ol>
<li>Create a filter</li>
<li>Has the words: &#8220;is:spam&#8221; (without quotes)</li>
<li>Next step</li>
<li>Say OK to the warning message</li>
<li>Check &#8220;Delete it&#8221;</li>
<li>Create Filter</li>
</ol>
<p>Now all of my spam is sent directly to the trash. Trashed items are automatically deleted after 30 days so I don&#8217;t have to manage it. And if someone calls asking why I didn&#8217;t respond, I can search the trash folder for the missing email.</p>
]]></content:encoded>
			<wfw:commentRss>http://harrylove.org/2007/04/30/automatically-delete-spam-from-gmail.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
