From 625704d192201d8314622dbec57f792c36888d91 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Thu, 27 Sep 2018 13:31:11 -0700 Subject: [PATCH 1/3] generalize version support and add search feature --- docs/_static/js/docversion.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/_static/js/docversion.js b/docs/_static/js/docversion.js index f87c4587b4a0..88da6dd64b69 100644 --- a/docs/_static/js/docversion.js +++ b/docs/_static/js/docversion.js @@ -1,5 +1,5 @@ function setVersion(){ - let doc = window.location.pathname.match(/^\/(api\/.*)$/) || window.location.pathname.match(/^\/versions\/[^*]+\/(api\/.*)$/); + let doc = window.location.pathname.match(/^\/versions\/[0-9.master]+\/([^*]+.*)$/); if (doc) { if (document.getElementById('dropdown-menu-position-anchor-version')) { versionNav = $('#dropdown-menu-position-anchor-version a.main-nav-link'); @@ -7,11 +7,11 @@ function setVersion(){ currLink = $( el ).attr('href'); version = currLink.match(/\/versions\/([0-9.master]+)\//); if (version) { - versionedDoc = '/versions/' + version[1] + '/' + doc[1] + (window.location.hash || ''); + versionedDoc = '/versions/' + version[1] + '/' + doc[1] + (window.location.hash || '') + (window.location.search || ''); $( el ).attr('href', versionedDoc); } }); - } + } } } From 5ec50a98966c2ab83d70ef082395e1ef6d6a5ed7 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Thu, 27 Sep 2018 15:16:03 -0700 Subject: [PATCH 2/3] suggest using version selector for their search --- docs/_static/searchtools_custom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_static/searchtools_custom.js b/docs/_static/searchtools_custom.js index 5f8c30a24f10..6a1b10b38588 100644 --- a/docs/_static/searchtools_custom.js +++ b/docs/_static/searchtools_custom.js @@ -570,7 +570,7 @@ var Search = { } Search.title.text(_('Search Results')); if (!resultCount) - Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.')); + Search.status.text(_('Your search did not match any documents in this version of the documentation. You can use the dropdown selector in the navigation bar to try another version. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.')); else Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount)); Search.status.fadeIn(500); From 588876ed49934cad63a44b0aa4609adf3e40bdbe Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Thu, 4 Oct 2018 14:42:33 -0700 Subject: [PATCH 3/3] update redirects to use default version env var; redirect root requests --- docs/build_version_doc/artifacts/.htaccess | 44 ++++++++++++---------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/docs/build_version_doc/artifacts/.htaccess b/docs/build_version_doc/artifacts/.htaccess index d553ce5a8dc6..661bd7c5f5d3 100644 --- a/docs/build_version_doc/artifacts/.htaccess +++ b/docs/build_version_doc/artifacts/.htaccess @@ -1,28 +1,32 @@ RewriteEngine on -RewriteRule ^get_started/why_mxnet.html$ /faq/why_mxnet.html [R=301,L] -RewriteRule ^get_started.*$ /install/ [R=301,L] -RewriteRule ^how_to.*$ /faq/ [R=301,L] -RewriteRule ^api/python/symbol.html$ /api/python/symbol/symbol.html [R=301,L] -RewriteRule ^community/index.html$ /community/contribute.html [R=301,L] +RewriteRule .* - [E=default_version:/versions/master] +RewriteRule ^get_started/why_mxnet.html$ %{ENV:default_version}/faq/why_mxnet.html [R=301,L] +RewriteRule ^get_started.*$ %{ENV:default_version}/install/ [R=301,L] +#RewriteRule ^get_started.*$ versions/master/install [R=301,L] +RewriteRule ^how_to.*$ %{ENV:default_version}/faq/ [R=301,L] +RewriteRule ^api/python/symbol.html$ %{ENV:default_version}/api/python/symbol/symbol.html [R=301,L] +RewriteRule ^community/index.html$ %{ENV:default_version}/community/contribute.html [R=301,L] # Navigation bar redirects to latest info -RewriteRule ^versions/[^\/]+/architecture/.*$ /architecture/ [R=301,L] -RewriteRule ^versions/[^\/]+/community/.*$ /community/ [R=301,L] -RewriteRule ^versions/[^\/]+/faq/.*$ /faq/ [R=301,L] -RewriteRule ^versions/[^\/]+/gluon/.*$ /gluon/ [R=301,L] -RewriteRule ^versions/[^\/]+/install/.*$ /install/ [R=301,L] -RewriteRule ^versions/[^\/]+/tutorials/(.*)$ /tutorials/$1 [R=301,L] +RewriteRule ^versions\/[0-9.]+\/architecture/(.*)$ %{ENV:default_version}/architecture/$1 [R=301,L] +RewriteRule ^versions\/[0-9.]+\/community/(.*)$ %{ENV:default_version}/community/$1 [R=301,L] +RewriteRule ^versions\/[0-9.]+\/faq/(.*)$ %{ENV:default_version}/faq/$1 [R=301,L] +RewriteRule ^versions\/[0-9.]+\/gluon/(.*)$ %{ENV:default_version}/gluon/$1 [R=301,L] +RewriteRule ^versions\/[0-9.]+\/install/(.*)$ %{ENV:default_version}/install/$1 [R=301,L] +RewriteRule ^versions\/[0-9.]+\/tutorials/(.*)$ %{ENV:default_version}/tutorials/$1 [R=301,L] # Redirect navbar APIs that did not exist -RewriteRule ^versions/0.11.0/api/python/contrib/onnx.html /error/api.html [R=301,L] -RewriteRule ^versions/0.12.1/api/python/contrib/onnx.html /error/api.html [R=301,L] -RewriteRule ^versions/1.0.0/api/python/contrib/onnx.html /error/api.html [R=301,L] -RewriteRule ^versions/1.1.0/api/python/contrib/onnx.html /error/api.html [R=301,L] +RewriteRule ^versions/0.11.0/api/python/contrib/onnx.html %{ENV:default_version}/error/api.html [R=301,L] +RewriteRule ^versions/0.12.1/api/python/contrib/onnx.html %{ENV:default_version}/error/api.html [R=301,L] +RewriteRule ^versions/1.0.0/api/python/contrib/onnx.html %{ENV:default_version}/error/api.html [R=301,L] +RewriteRule ^versions/1.1.0/api/python/contrib/onnx.html %{ENV:default_version}/error/api.html [R=301,L] -RewriteRule ^versions/0.11.0/api/clojure/.*$ /error/api.html [R=301,L] -RewriteRule ^versions/0.12.1/api/clojure/.*$ /error/api.html [R=301,L] -RewriteRule ^versions/1.0.0/api/clojure/.*$ /error/api.html [R=301,L] -RewriteRule ^versions/1.1.0/api/clojure/.*$ /error/api.html [R=301,L] -RewriteRule ^versions/1.2.1/api/clojure/.*$ /error/api.html [R=301,L] +RewriteRule ^versions/0.11.0/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L] +RewriteRule ^versions/0.12.1/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L] +RewriteRule ^versions/1.0.0/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L] +RewriteRule ^versions/1.1.0/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L] +RewriteRule ^versions/1.2.1/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L] +# Redirect any root requests to the default version +RewriteRule ^(?!versions\/[0-9.master]+\/)(.*)$ %{ENV:default_version}/$1 [R=301,NC,L] ErrorDocument 404 https://mxnet.incubator.apache.org/error/404.html