Created
April 9, 2012 07:29
-
-
Save fotos/2342129 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- redirect.rb 2012-04-09 11:58:39.905024214 +0300 | |
+++ redirect-pages.rb 2012-04-09 11:58:10.441025135 +0300 | |
@@ -15,9 +15,9 @@ | |
# find all posts with a redirect property and create a new page for each entry | |
def generate_redirects(site) | |
- site.posts.select{|x| x.data.key? 'redirects' }.each do |p| | |
+ (site.pages + site.posts).select{|x| x.data.key? 'redirects' }.each do |p| | |
p.data['redirects'].each do |r| | |
- redirect = RedirectPage.new(site, site.source, r, p.id) | |
+ redirect = RedirectPage.new(site, site.source, r, p.url) | |
redirect.render(site.layouts, site.site_payload) | |
redirect.write(site.dest) | |
site.pages << redirect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment