mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Add redirection for MDN WindowTimers docs
This commit is contained in:
parent
a13ac78a8c
commit
d7bfbee0fe
1 changed files with 13 additions and 2 deletions
15
lib/app.rb
15
lib/app.rb
|
@ -300,8 +300,19 @@ class App < Sinatra::Application
|
|||
|
||||
get %r{\A/([\w~\.%]+)(\-[\w\-]+)?(/.*)?\z} do |doc, type, rest|
|
||||
doc.sub! '%7E', '~'
|
||||
return redirect "/#{DOC_REDIRECTS[doc]}#{type}#{rest}", 301 if DOC_REDIRECTS.key?(doc)
|
||||
return redirect "/angularjs/api#{rest}", 301 if doc == 'angular' && rest && rest.start_with?('/ng')
|
||||
|
||||
if DOC_REDIRECTS.key?(doc)
|
||||
return redirect "/#{DOC_REDIRECTS[doc]}#{type}#{rest}", 301
|
||||
end
|
||||
|
||||
if rest && doc == 'angular' && rest.start_with?('/ng')
|
||||
return redirect "/angularjs/api#{rest}", 301
|
||||
end
|
||||
|
||||
if rest && doc == 'dom' && rest.start_with?('/windowtimers')
|
||||
return redirect "/dom#{rest.sub('windowtimers', 'windoworworkerglobalscope')}"
|
||||
end
|
||||
|
||||
return 404 unless @doc = find_doc(doc)
|
||||
|
||||
if rest.nil?
|
||||
|
|
Loading…
Reference in a new issue