Skip to content

Commit

Permalink
Feed: Use full URL for entry links; set <updated>.
Browse files Browse the repository at this point in the history
Relative URLs for entries confused TwitterFeed.com, so we now use the full
URL.

Previously, the <updated> element of <feed> wasn't dynamic. Now it's set to
the date of the most recent entry.
  • Loading branch information
runpaint committed May 13, 2009
1 parent b95dc6d commit 8f68074
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ task :html => SOURCE_HTML do |t|
result({:toc => toc.dup.reject{|e| e[:type] == :subsection}})
mkdir_p 'output/toc'
File.open('output/toc/index.html','w') {|file| file.puts page}
recipes_by_time = toc.reject{|e| e[:type] == :subsection}.
sort_by{|e| e[:time]}.reverse
page = Erubis::Eruby.new(File.open('templates/atom.atom').read).
result({:toc => toc.
reject{|e| e[:type] == :subsection}.sort_by{|e| e[:time]}.reverse
result({:toc => recipes_by_time,
:updated => recipes_by_time.first[:time]
})
File.open('output/index.atom','w') {|file| file.puts page}
end
Expand Down
7 changes: 3 additions & 4 deletions templates/atom.atom
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@
xmlns:thr="http://purl.org/syndication/thread/1.0">
<link rel="self" href="http://vim.runpaint.org/index.atom"/>
<id>http://vim.runpaint.org/index.atom</id>

<title>Vim Recipes</title>
<subtitle>A cookbook for the Vim text editor</subtitle>
<author>
<name>Run Paint Run Run</name>
<email>runrun@runpaint.org</email>
<uri>http://runpaint.org/</uri>
</author>
<updated>2009-05-13T08:42:22-04:00</updated> <!-- FIXME -->
<% require 'time' %>
<updated><%= updated.xmlschema %></updated>
<link href="http://vim.runpaint.org/"/>
<link rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"/>

<%
require 'time'
toc.each do |entry|
next unless entry[:type] == :recipe
%>
<entry>
<id>tag:vim.runpaint.org,2009:<%= entry[:id] %></id>
<link href="/<%= entry[:section_id] %>/<%= entry[:id] %>/"/>
<link href="http://vim.runpaint.org/<%= entry[:section_id] %>/<%= entry[:id] %>/"/>
<title><%= entry[:title] %></title>
<updated><%= entry[:time].xmlschema %></updated>
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
Expand Down

0 comments on commit 8f68074

Please sign in to comment.