aboutsummaryrefslogtreecommitdiff
path: root/_plugins/generate_sitemap.rb
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2011-05-15 18:33:00 -0400
committerBrandon Mathis <brandon@imathis.com>2011-05-15 18:33:00 -0400
commitc7d5365f81552cae16bbb91696ca3e67b4a0a2e9 (patch)
tree76c57e41828a3492535cde7fe82bef98ccea0eb4 /_plugins/generate_sitemap.rb
parente4c2d5790bac6a74037638fde049c374fc44cc7b (diff)
downloadmy_new_personal_website-c7d5365f81552cae16bbb91696ca3e67b4a0a2e9.tar.xz
my_new_personal_website-c7d5365f81552cae16bbb91696ca3e67b4a0a2e9.zip
major refactoring, improved file watching, changed site to public to support rack via pow (http://pow.cx) also implemented the basics of a 320 and up design refresh on the classic theme. This should make it great for mobile reading
Diffstat (limited to '')
-rw-r--r--_plugins/generate_sitemap.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/_plugins/generate_sitemap.rb b/_plugins/generate_sitemap.rb
index 488a992b..4d580c47 100644
--- a/_plugins/generate_sitemap.rb
+++ b/_plugins/generate_sitemap.rb
@@ -44,7 +44,6 @@ module Jekyll
priority :low
# Domain that you are generating the sitemap for - update this to match your site.
- BASE_URL = 'http://recursive-design.com'
# Generates the sitemap.xml file.
#
@@ -82,6 +81,8 @@ module Jekyll
def generate_content(site)
result = ''
+ base_url = site.config['url']
+
# First, try to find any stand-alone pages.
site.pages.each{ |page|
path = page.subfolder + '/' + page.name
@@ -93,14 +94,14 @@ module Jekyll
end
unless path =~/error/
- result += entry(path, mod_date)
+ result += entry(base_url, path, mod_date)
end
}
# Next, find all the posts.
posts = site.site_payload['site']['posts']
for post in posts do
- result += entry(post.id, post.date)
+ result += entry(base_url, post.id, post.date)
end
result
@@ -115,12 +116,12 @@ module Jekyll
#
# +path+ is the URL path to the page.
# +date+ is the date the file was modified (in the case of regular pages), or published (for blog posts).
- def entry(path, date)
+ def entry(base_url, path, date)
# Force extensions to .html from markdown, textile.
path = path.gsub(/\.(markdown|textile)$/i, '.html')
"
<url>
- <loc>#{BASE_URL}#{path}</loc>
+ <loc>#{base_url}#{path}</loc>
<lastmod>#{date.strftime("%Y-%m-%d")}</lastmod>
</url>"
end