From dc141114b380b9ca6741297614721be7c3638738 Mon Sep 17 00:00:00 2001 From: Saivann Date: Thu, 13 Jun 2013 18:20:49 -0400 Subject: [PATCH] Remove redirect pages from sitemap --- _plugins/sitemap.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/_plugins/sitemap.rb b/_plugins/sitemap.rb index cbef09b9..0589019d 100644 --- a/_plugins/sitemap.rb +++ b/_plugins/sitemap.rb @@ -48,13 +48,19 @@ module Jekyll if /^[a-z]{2}(_[A-Z]{2})?$/.match(file1) and File.directory?(file1) Dir.foreach(file1) do |file2| next if !/\.html$/.match(file2) + #Ignore static redirect pages + data = File.read(file1+'/'+file2) + next if !data.index('window.location.href=').nil? sitemap.puts '' sitemap.puts ' http://bitcoin.org/'+file1+'/'+file2.gsub('.html','')+'' sitemap.puts '' end end next if !/\.html$/.match(file1) - next if file1 == 'index.html' || file1 == '404.html' + next if file1 == 'index.html' + #Ignore static redirect pages and google webmaster tools + data = File.read(file1) + next if !data.index('window.location.href=').nil? or !data.index('google-site-verification:').nil? sitemap.puts '' sitemap.puts ' http://bitcoin.org/'+file1.gsub('.html','')+'' sitemap.puts ''