updated atom feed to use full_url passed from yaml for post urls
This commit is contained in:
parent
c27f5f8e5a
commit
bc9dd41b84
@ -174,8 +174,8 @@ module Helpers
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def absolute_url(input)
|
def absolute_url(input, url)
|
||||||
input.gsub(/(href|src)(\s*=\s*)(["'])(\/.*?)\3/) { $1 + $2 + $3 + "http://brandonmathis.com" + $4 + $3 }
|
input.gsub(/(href|src)(\s*=\s*)(["'])(\/.*?)\3/) { $1 + $2 + $3 + url + $4 + $3 }
|
||||||
end
|
end
|
||||||
|
|
||||||
def rp(input)
|
def rp(input)
|
||||||
|
@ -3,23 +3,23 @@ layout: nil
|
|||||||
author: Your Name
|
author: Your Name
|
||||||
email: author@domain.com
|
email: author@domain.com
|
||||||
blog_title: My Octopress Blog
|
blog_title: My Octopress Blog
|
||||||
root_url: http://yoursite.com
|
full_url: http://yoursite.com
|
||||||
---
|
---
|
||||||
!!! XML
|
!!! XML
|
||||||
%feed(xmlns="http://www.w3.org/2005/Atom")
|
%feed(xmlns="http://www.w3.org/2005/Atom")
|
||||||
%title= page.blog_title
|
%title= page.blog_title
|
||||||
%link(href="#{page.root_url}/atom.xml" rel="self")
|
%link(href="#{page.full_url}/atom.xml" rel="self")
|
||||||
%link(href="#{page.root_url}")
|
%link(href="#{page.full_url}")
|
||||||
%updated= Time.now.xmlschema
|
%updated= Time.now.xmlschema
|
||||||
%id=page.root_url
|
%id=page.full_url
|
||||||
%author
|
%author
|
||||||
%name= page.author
|
%name= page.author
|
||||||
%email= page.email
|
%email= page.email
|
||||||
- site.posts[0..14].each do |post|
|
- site.posts[0..14].each do |post|
|
||||||
%entry
|
%entry
|
||||||
%title= rp(post.title)
|
%title= rp(post.title)
|
||||||
%link(href="#{page.root_url}#{post.url}")
|
%link(href="#{page.full_url}#{post.url}")
|
||||||
%updated=post.date.xmlschema
|
%updated=post.date.xmlschema
|
||||||
%id= "#{page.root_url}#{post.id}"
|
%id= "#{page.full_url}#{post.id}"
|
||||||
%content(type="html")
|
%content(type="html")
|
||||||
= h(absolute_url(rp(post.content)))
|
= h(absolute_url(rp(post.content), page.full_url))
|
Loading…
Reference in New Issue
Block a user