mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 01:36:13 +00:00
Update sitemap plugin to include English pages from subdirectories
This commit is contained in:
parent
9b47198e0f
commit
1ddfe6f2c7
1 changed files with 6 additions and 16 deletions
|
@ -62,33 +62,23 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#Add static non-translated pages
|
#Add static non-translated pages
|
||||||
Dir.foreach('.') do |file1|
|
Dir.glob('en/**/*.{md,html}').concat(Dir.glob('*.{md,html}')).each do |file|
|
||||||
if /^[a-z]{2}(_[A-Z]{2})?$/.match(file1) and File.directory?(file1)
|
next if file == 'index.html' or file == '404.html' or file == 'README.md'
|
||||||
Dir.foreach(file1) do |file2|
|
|
||||||
next if !/\.html$|\.md$/.match(file2)
|
|
||||||
data = File.read(file1+'/'+file2)
|
|
||||||
sitemap.puts '<url>'
|
|
||||||
sitemap.puts ' <loc>https://bitcoin.org/'+file1+'/'+file2.gsub('.html','').gsub('.md','')+'</loc>'
|
|
||||||
sitemap.puts '</url>'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
next if !/\.html$|\.md$/.match(file1)
|
|
||||||
next if file1 == 'index.html' or file1 == '404.html' or file1 == 'README.md'
|
|
||||||
#Ignore google webmaster tools
|
#Ignore google webmaster tools
|
||||||
data = File.read(file1)
|
data = File.read(file)
|
||||||
next if !data.index('google-site-verification:').nil?
|
next if !data.index('google-site-verification:').nil?
|
||||||
sitemap.puts '<url>'
|
sitemap.puts '<url>'
|
||||||
sitemap.puts ' <loc>https://bitcoin.org/'+file1.gsub('.html','').gsub('.md','')+'</loc>'
|
sitemap.puts ' <loc>https://bitcoin.org/'+file.gsub('.html','').gsub('.md','')+'</loc>'
|
||||||
sitemap.puts '</url>'
|
sitemap.puts '</url>'
|
||||||
end
|
end
|
||||||
#Add english alerts pages
|
#Add alerts pages
|
||||||
Dir.foreach('_alerts') do |file|
|
Dir.foreach('_alerts') do |file|
|
||||||
next if file == '.' or file == '..'
|
next if file == '.' or file == '..'
|
||||||
sitemap.puts '<url>'
|
sitemap.puts '<url>'
|
||||||
sitemap.puts ' <loc>https://bitcoin.org/en/alert/'+file.gsub('.html','')+'</loc>'
|
sitemap.puts ' <loc>https://bitcoin.org/en/alert/'+file.gsub('.html','')+'</loc>'
|
||||||
sitemap.puts '</url>'
|
sitemap.puts '</url>'
|
||||||
end
|
end
|
||||||
#Add english releases pages
|
#Add releases pages
|
||||||
Dir.foreach('_releases') do |file|
|
Dir.foreach('_releases') do |file|
|
||||||
next if file == '.' or file == '..'
|
next if file == '.' or file == '..'
|
||||||
file = file.split('-')
|
file = file.split('-')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue