From 1ddfe6f2c797a54c4e3e0e93fd729fb8f0f50e2d Mon Sep 17 00:00:00 2001 From: Saivann Date: Wed, 9 Sep 2015 15:16:24 -0400 Subject: [PATCH] Update sitemap plugin to include English pages from subdirectories --- _plugins/sitemap.rb | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/_plugins/sitemap.rb b/_plugins/sitemap.rb index 795c0a66..b6b678ac 100644 --- a/_plugins/sitemap.rb +++ b/_plugins/sitemap.rb @@ -62,33 +62,23 @@ module Jekyll end end #Add static non-translated pages - Dir.foreach('.') do |file1| - if /^[a-z]{2}(_[A-Z]{2})?$/.match(file1) and File.directory?(file1) - Dir.foreach(file1) do |file2| - next if !/\.html$|\.md$/.match(file2) - data = File.read(file1+'/'+file2) - sitemap.puts '' - sitemap.puts ' https://bitcoin.org/'+file1+'/'+file2.gsub('.html','').gsub('.md','')+'' - sitemap.puts '' - end - end - next if !/\.html$|\.md$/.match(file1) - next if file1 == 'index.html' or file1 == '404.html' or file1 == 'README.md' + Dir.glob('en/**/*.{md,html}').concat(Dir.glob('*.{md,html}')).each do |file| + next if file == 'index.html' or file == '404.html' or file == 'README.md' #Ignore google webmaster tools - data = File.read(file1) + data = File.read(file) next if !data.index('google-site-verification:').nil? sitemap.puts '' - sitemap.puts ' https://bitcoin.org/'+file1.gsub('.html','').gsub('.md','')+'' + sitemap.puts ' https://bitcoin.org/'+file.gsub('.html','').gsub('.md','')+'' sitemap.puts '' end - #Add english alerts pages + #Add alerts pages Dir.foreach('_alerts') do |file| next if file == '.' or file == '..' sitemap.puts '' sitemap.puts ' https://bitcoin.org/en/alert/'+file.gsub('.html','')+'' sitemap.puts '' end - #Add english releases pages + #Add releases pages Dir.foreach('_releases') do |file| next if file == '.' or file == '..' file = file.split('-')