From 02a2a7d7d4a94391cace44a115d85f7dd3c609ca Mon Sep 17 00:00:00 2001 From: Maxime Date: Wed, 7 Feb 2018 12:05:46 +0100 Subject: [PATCH] fix redirects --- docs/config.rb | 10 ++-------- docs/source/templates/redirect.html.erb | 10 ++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 docs/source/templates/redirect.html.erb diff --git a/docs/config.rb b/docs/config.rb index 8d56c2e8..487910ab 100644 --- a/docs/config.rb +++ b/docs/config.rb @@ -53,7 +53,6 @@ configure :server do #activate :livereload use BetterErrors::Middleware BetterErrors.application_root = __dir__ - redirects.push({from: '/index.html' , to: '/docsearch'}) end # Build-specific configuration @@ -73,13 +72,8 @@ end ready do - no_redirect = ENV['NO_REDIRECTS'] && (ENV['NO_REDIRECTS'] == 'true') - is_travis_pr_build = ENV['TRAVIS_PULL_REQUEST'] && (ENV['TRAVIS_PULL_REQUEST'] != 'false') - - if not no_redirect and not is_travis_pr_build - redirects.each do |r| - redirect r[:from][1..-1], to: r[:to] - end + redirects.each do |r| + proxy r[:from][1..-1], 'templates/redirect.html', locals: {url: r[:to]}, ignore: true, layout: nil end proxy '/_redirects', 'templates/redirects', locals: {redirects: redirects}, ignore: true diff --git a/docs/source/templates/redirect.html.erb b/docs/source/templates/redirect.html.erb new file mode 100644 index 00000000..ffde4481 --- /dev/null +++ b/docs/source/templates/redirect.html.erb @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file