mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 09:46:12 +00:00
URL encode non-ASCII characters in sitemap
This commit is contained in:
parent
acb750f2b6
commit
b5d08a58a4
1 changed files with 4 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
|||
require 'open-uri'
|
||||
|
||||
module Jekyll
|
||||
|
||||
class SitemapFile < StaticFile
|
||||
|
@ -30,13 +32,13 @@ module Jekyll
|
|||
locs.each do |lang,value|
|
||||
next if locs[lang]['url'][id].nil? or locs[lang]['url'][id] == ''
|
||||
sitemap.puts '<url>'
|
||||
sitemap.puts ' <loc>http://bitcoin.org/'+lang+'/'+locs[lang]['url'][id]+'</loc>'
|
||||
sitemap.puts ' <loc>http://bitcoin.org/'+lang+'/'+CGI::escape(locs[lang]['url'][id])+'</loc>'
|
||||
locs.each do |altlang,value|
|
||||
next if locs[altlang]['url'][id].nil? or locs[altlang]['url'][id] == '' or altlang == lang
|
||||
sitemap.puts ' <xhtml:link'
|
||||
sitemap.puts ' rel="alternate"'
|
||||
sitemap.puts ' hreflang="'+altlang+'"'
|
||||
sitemap.puts ' href="http://bitcoin.org/'+altlang+'/'+locs[altlang]['url'][id]+'" />'
|
||||
sitemap.puts ' href="http://bitcoin.org/'+altlang+'/'+CGI::escape(locs[altlang]['url'][id])+'" />'
|
||||
end
|
||||
sitemap.puts '</url>'
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue