Merge pull request #384 from voxpelli/drupal-alias-redirect
Added redirects for Drupal posts' URL-aliases
This commit is contained in:
commit
1292c02ec0
|
@ -78,8 +78,13 @@ EOF
|
||||||
|
|
||||||
# Make a file to redirect from the old Drupal URL
|
# Make a file to redirect from the old Drupal URL
|
||||||
if is_published
|
if is_published
|
||||||
FileUtils.mkdir_p "node/#{node_id}"
|
aliases = db["SELECT dst FROM #{prefix}url_alias WHERE src = ?", "node/#{node_id}"].all
|
||||||
File.open("node/#{node_id}/index.md", "w") do |f|
|
|
||||||
|
aliases.push(:dst => "node/#{node_id}")
|
||||||
|
|
||||||
|
aliases.each do |url_alias|
|
||||||
|
FileUtils.mkdir_p url_alias[:dst]
|
||||||
|
File.open("#{url_alias[:dst]}/index.md", "w") do |f|
|
||||||
f.puts "---"
|
f.puts "---"
|
||||||
f.puts "layout: refresh"
|
f.puts "layout: refresh"
|
||||||
f.puts "refresh_to_post_id: /#{time.strftime("%Y/%m/%d/") + slug}"
|
f.puts "refresh_to_post_id: /#{time.strftime("%Y/%m/%d/") + slug}"
|
||||||
|
@ -87,6 +92,7 @@ EOF
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# TODO: Make dirs & files for nodes of type 'page'
|
# TODO: Make dirs & files for nodes of type 'page'
|
||||||
# Make refresh pages for these as well
|
# Make refresh pages for these as well
|
||||||
|
|
Loading…
Reference in New Issue