diff --git a/_layouts/alert.html b/_layouts/alert.html index da2ffb14..b5497cda 100644 --- a/_layouts/alert.html +++ b/_layouts/alert.html @@ -2,10 +2,12 @@ layout: base lang: en --- -{% if page.redirect != nil %} - - + +{% if page.canonical != nil %} + + {% endif %} +

{{ page.title }}
{{ page.date | date:"%e %B %Y" }}

diff --git a/_layouts/redirect.html b/_layouts/redirect.html new file mode 100644 index 00000000..9cdd48ec --- /dev/null +++ b/_layouts/redirect.html @@ -0,0 +1,11 @@ +--- +layout: base +--- + + + + +
+

This page has been moved

+

bitcoin.org{{ page.redirect }}

+
diff --git a/_layouts/release.html b/_layouts/release.html index 629a1986..bbc1ee67 100644 --- a/_layouts/release.html +++ b/_layouts/release.html @@ -2,10 +2,6 @@ layout: base lang: en --- -{% if page.redirect != nil %} - - -{% endif %}

{{ page.title }}
{{ page.date | date:"%e %B %Y" }}

diff --git a/_less/screen.less b/_less/screen.less index b50c69cf..0e6c0760 100644 --- a/_less/screen.less +++ b/_less/screen.less @@ -881,6 +881,19 @@ h2 .rssicon{ font-weight:bold; } +.redirectmsg{ + text-align:center; + margin:20px 0px; +} +.redirectmsg h1{ + color:#7b7c7c; + font-weight:400; + font-size:180%; +} +.redirectmsg p{ + font-size:150%; +} + .download{ text-align:center; } diff --git a/_plugins/alerts.rb b/_plugins/alerts.rb index aca26f71..01171ef1 100644 --- a/_plugins/alerts.rb +++ b/_plugins/alerts.rb @@ -14,7 +14,7 @@ module Jekyll self.data['date'] = date self.data['layout'] = 'alert' if dstdir == '' - self.data['redirect'] = src.split('.')[0] + self.data['canonical'] = '/en/alert/' + src.split('.')[0] else self.data['category'] = 'alert' if self.data.has_key?('banner') and !self.data['banner'].nil? and self.data['banner'].length>0 diff --git a/_plugins/releases.rb b/_plugins/releases.rb index c8887dc9..ae70d50a 100644 --- a/_plugins/releases.rb +++ b/_plugins/releases.rb @@ -14,7 +14,8 @@ module Jekyll self.data['date'] = year + '-' + month + '-' + day self.data['layout'] = 'release' if dstdir.index('/releases/') === 0 - self.data['redirect'] = dst.gsub('.md','') + self.data['redirect'] = '/en/release/' + dst.gsub('.md','') + self.data['layout'] = 'redirect' else self.data['category'] = 'release' if !site.config.has_key?('DOWNLOAD_DATE') or site.config['DOWNLOAD_DATE'] < year + '-' + month + '-' + day diff --git a/_plugins/sitemap.rb b/_plugins/sitemap.rb index edc8b3e7..00f93bd0 100644 --- a/_plugins/sitemap.rb +++ b/_plugins/sitemap.rb @@ -71,7 +71,7 @@ module Jekyll next if !/\.html$/.match(file2) #Ignore static redirect pages data = File.read(file1+'/'+file2) - next if !data.index('window.location.href=').nil? + next if !data.index('window.location.href=').nil? or !data.index('redirect:').nil? sitemap.puts '' sitemap.puts ' http://bitcoin.org/'+file1+'/'+file2.gsub('.html','')+'' sitemap.puts '' @@ -81,7 +81,7 @@ module Jekyll 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? + next if !data.index('window.location.href=').nil? or !data.index('redirect:').nil? or !data.index('google-site-verification:').nil? sitemap.puts '' sitemap.puts ' http://bitcoin.org/'+file1.gsub('.html','')+'' sitemap.puts '' diff --git a/_plugins/templates.rb b/_plugins/templates.rb index bfc696c9..2163a0e8 100644 --- a/_plugins/templates.rb +++ b/_plugins/templates.rb @@ -22,9 +22,17 @@ module Jekyll end end - class TranslateRedirect < StaticFile - def write(dest) - # do nothing + class PageRedirect < Page + def initialize(site, base, lang, srcdir, src, dstdir, dst, red) + @site = site + @base = base + @dir = '/'+dstdir + @name = dst + self.process(dst) + self.read_yaml(File.join(base, srcdir), src) + self.data['lang'] = lang + self.data['redirect'] = red + self.data['layout'] = 'redirect' end end @@ -63,23 +71,16 @@ module Jekyll end redirects.each do |id,redirect| next if redirect.has_key?('except') and redirect['except'].has_key?(lang) - src = locs[lang]['url'][id] - next if src.nil? or src == '' - src = src+'.html' - dst = redirect['dst'] - dst = locs[lang]['url'][dst] + src = redirect['dst'] + src = src + '.html' + dst = locs[lang]['url'][id] next if dst.nil? or dst == '' - if !File.directory?(site.dest + '/' + lang) - Dir.mkdir(site.dest + '/' + lang) - end - File.open(site.dest + '/' + lang + '/' + src, 'w+') do |file| - file.puts '' - file.puts '' - file.puts '' - file.puts '' - file.puts '' - end - site.static_files << TranslateRedirect.new(site, site.source, '', lang+'/'+src) + dst = dst + '.html' + red = redirect['dst'] + red = locs[lang]['url'][red] + next if red.nil? or red == '' + red = '/' + lang + '/' + CGI::escape(red) + site.pages << PageRedirect.new(site, site.source, lang, '_templates', src, lang, dst, red) end end end diff --git a/about.html b/about.html index 182fde55..6808fba9 100644 --- a/about.html +++ b/about.html @@ -1,8 +1,5 @@ - - - - - - - - +--- +layout: redirect +redirect: /en/faq +lang: en +--- diff --git a/clients.html b/clients.html index 0bb45158..b739fb5b 100644 --- a/clients.html +++ b/clients.html @@ -1,8 +1,5 @@ - - - - - - - - +--- +layout: redirect +redirect: /en/choose-your-wallet +lang: en +--- diff --git a/news.html b/news.html index 54e61ab5..b2ebd202 100644 --- a/news.html +++ b/news.html @@ -1,8 +1,5 @@ - - - - - - - - +--- +layout: redirect +redirect: /en/version-history +lang: en +---