Browse code

updated atom feed to use full_url passed from yaml for post urls

B Mathis authored on 08/11/2009 at 05:02:55
Showing 2 changed files
... ...
@@ -174,8 +174,8 @@ module Helpers
174 174
     end
175 175
   end
176 176
   
177
-  def absolute_url(input)
178
-    input.gsub(/(href|src)(\s*=\s*)(["'])(\/.*?)\3/) { $1 + $2 + $3 + "http://brandonmathis.com" + $4 + $3 }
177
+  def absolute_url(input, url)
178
+    input.gsub(/(href|src)(\s*=\s*)(["'])(\/.*?)\3/) { $1 + $2 + $3 + url + $4 + $3 }
179 179
   end
180 180
   
181 181
   def rp(input)
... ...
@@ -3,23 +3,23 @@ layout: nil
3 3
 author: Your Name
4 4
 email: author@domain.com
5 5
 blog_title: My Octopress Blog
6
-root_url: http://yoursite.com
6
+full_url: http://yoursite.com
7 7
 ---
8 8
 !!! XML
9 9
 %feed(xmlns="http://www.w3.org/2005/Atom")
10 10
   %title= page.blog_title
11
-  %link(href="#{page.root_url}/atom.xml" rel="self")
12
-  %link(href="#{page.root_url}")
11
+  %link(href="#{page.full_url}/atom.xml" rel="self")
12
+  %link(href="#{page.full_url}")
13 13
   %updated= Time.now.xmlschema
14
-  %id=page.root_url
14
+  %id=page.full_url
15 15
   %author
16 16
     %name= page.author
17 17
     %email= page.email
18 18
   - site.posts[0..14].each do |post|
19 19
     %entry
20 20
       %title= rp(post.title)
21
-      %link(href="#{page.root_url}#{post.url}")
21
+      %link(href="#{page.full_url}#{post.url}")
22 22
       %updated=post.date.xmlschema
23
-      %id= "#{page.root_url}#{post.id}"
23
+      %id= "#{page.full_url}#{post.id}"
24 24
       %content(type="html")
25
-        = h(absolute_url(rp(post.content)))
26 25
\ No newline at end of file
26
+        = h(absolute_url(rp(post.content), page.full_url))
27 27
\ No newline at end of file