From 3e4abe6d2db4201ce5967a885fee00d987502d04 Mon Sep 17 00:00:00 2001 From: chenxsan Date: Mon, 19 Jul 2021 20:54:29 +0800 Subject: [PATCH 1/9] add webpack-options page --- src/components/Sidebar/Sidebar.jsx | 40 ++++++++++--------- src/components/Site/clientSideRedirections.js | 6 +++ src/content/webpack-options.md | 5 +++ 3 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 src/content/webpack-options.md diff --git a/src/components/Sidebar/Sidebar.jsx b/src/components/Sidebar/Sidebar.jsx index f555a71cf21b..7f0e241a838e 100644 --- a/src/components/Sidebar/Sidebar.jsx +++ b/src/components/Sidebar/Sidebar.jsx @@ -13,6 +13,8 @@ import LoadingIcon from '../../styles/icons/loading.svg'; const versions = [5, 4]; const currentDocsVersion = 5; +const excludedPages = ['/webpack-options/']; + Sidebar.propTypes = { className: PropTypes.string, pages: PropTypes.array, @@ -69,26 +71,28 @@ export default function Sidebar({ className = '', pages, currentPage }) { - {pages.map((page, index) => { - let displayGroup = group !== page.group && page.group !== '-'; - group = page.group; + {pages + .filter((page) => excludedPages.includes(page.url) === false) + .map((page, index) => { + let displayGroup = group !== page.group && page.group !== '-'; + group = page.group; - return ( -
- {displayGroup ? ( -

{group}

- ) : null} + return ( +
+ {displayGroup ? ( +

{group}

+ ) : null} - -
- ); - })} + +
+ ); + })} ); diff --git a/src/components/Site/clientSideRedirections.js b/src/components/Site/clientSideRedirections.js index 53ba4f55d5bf..2360cc4872dd 100644 --- a/src/components/Site/clientSideRedirections.js +++ b/src/components/Site/clientSideRedirections.js @@ -9,5 +9,11 @@ export default function (location) { ) { return `/configuration/cache/${location.hash}`; } + + if (location.pathname === '/webpack-options/') { + const searchParams = new URLSearchParams(location.search); + console.log(searchParams.get('option')); + return `${searchParams.get('option')}${location.hash}`; + } return false; } diff --git a/src/content/webpack-options.md b/src/content/webpack-options.md new file mode 100644 index 000000000000..77d0621542e8 --- /dev/null +++ b/src/content/webpack-options.md @@ -0,0 +1,5 @@ +--- +title: Webpack Options +--- + +hello webpack. From e12c4aa9589a65bb7288045e98814eb77474a626 Mon Sep 17 00:00:00 2001 From: chenxsan Date: Mon, 19 Jul 2021 21:27:03 +0800 Subject: [PATCH 2/9] update --- src/components/Site/clientSideRedirections.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Site/clientSideRedirections.js b/src/components/Site/clientSideRedirections.js index 2360cc4872dd..9543a608dab0 100644 --- a/src/components/Site/clientSideRedirections.js +++ b/src/components/Site/clientSideRedirections.js @@ -12,8 +12,9 @@ export default function (location) { if (location.pathname === '/webpack-options/') { const searchParams = new URLSearchParams(location.search); - console.log(searchParams.get('option')); - return `${searchParams.get('option')}${location.hash}`; + const option = searchParams.get('option'); + const options = option.split('/').filter(Boolean); + return `/configuration/${options[0]}/#${options.join('').toLowerCase()}`; } return false; } From e58a0fbc3b2f872f604c2c86d2728c527c4532ab Mon Sep 17 00:00:00 2001 From: chenxsan Date: Mon, 19 Jul 2021 22:53:32 +0800 Subject: [PATCH 3/9] update intermediate page --- src/components/Site/clientSideRedirections.js | 6 ++++-- src/content/{webpack-options.md => webpack/options.md} | 0 2 files changed, 4 insertions(+), 2 deletions(-) rename src/content/{webpack-options.md => webpack/options.md} (100%) diff --git a/src/components/Site/clientSideRedirections.js b/src/components/Site/clientSideRedirections.js index 9543a608dab0..42c59dad115c 100644 --- a/src/components/Site/clientSideRedirections.js +++ b/src/components/Site/clientSideRedirections.js @@ -10,10 +10,12 @@ export default function (location) { return `/configuration/cache/${location.hash}`; } - if (location.pathname === '/webpack-options/') { + if (location.pathname === '/webpack/options/') { + // target urls like /webpack/options/?option=output/filename const searchParams = new URLSearchParams(location.search); - const option = searchParams.get('option'); + const option = searchParams.get('option') || ''; const options = option.split('/').filter(Boolean); + if (options.length === 0) return '/configuration/'; return `/configuration/${options[0]}/#${options.join('').toLowerCase()}`; } return false; diff --git a/src/content/webpack-options.md b/src/content/webpack/options.md similarity index 100% rename from src/content/webpack-options.md rename to src/content/webpack/options.md From d3af04c647d44c3f69ca1161548c81dc5c7c1834 Mon Sep 17 00:00:00 2001 From: chenxsan Date: Mon, 19 Jul 2021 22:55:26 +0800 Subject: [PATCH 4/9] fix excludePages --- src/components/Sidebar/Sidebar.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Sidebar/Sidebar.jsx b/src/components/Sidebar/Sidebar.jsx index 7f0e241a838e..6edc14c899e1 100644 --- a/src/components/Sidebar/Sidebar.jsx +++ b/src/components/Sidebar/Sidebar.jsx @@ -13,7 +13,7 @@ import LoadingIcon from '../../styles/icons/loading.svg'; const versions = [5, 4]; const currentDocsVersion = 5; -const excludedPages = ['/webpack-options/']; +const excludedPages = ['/webpack/options/']; Sidebar.propTypes = { className: PropTypes.string, From 1a4976a2a36c054b7864d45cd15c5fafa8e3c783 Mon Sep 17 00:00:00 2001 From: chenxsan Date: Tue, 20 Jul 2021 08:52:09 +0800 Subject: [PATCH 5/9] update url pattern --- src/components/Sidebar/Sidebar.jsx | 4 +++- src/components/Site/clientSideRedirections.js | 4 ++-- src/content/{webpack/options.md => r/webpack.mdx} | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) rename src/content/{webpack/options.md => r/webpack.mdx} (68%) diff --git a/src/components/Sidebar/Sidebar.jsx b/src/components/Sidebar/Sidebar.jsx index 6edc14c899e1..735fe34a8b2f 100644 --- a/src/components/Sidebar/Sidebar.jsx +++ b/src/components/Sidebar/Sidebar.jsx @@ -13,7 +13,9 @@ import LoadingIcon from '../../styles/icons/loading.svg'; const versions = [5, 4]; const currentDocsVersion = 5; -const excludedPages = ['/webpack/options/']; +// hide them from sidebar +// r for `redirect` +const excludedPages = ['/r/webpack/']; Sidebar.propTypes = { className: PropTypes.string, diff --git a/src/components/Site/clientSideRedirections.js b/src/components/Site/clientSideRedirections.js index 42c59dad115c..d343e1661f1a 100644 --- a/src/components/Site/clientSideRedirections.js +++ b/src/components/Site/clientSideRedirections.js @@ -10,11 +10,11 @@ export default function (location) { return `/configuration/cache/${location.hash}`; } - if (location.pathname === '/webpack/options/') { - // target urls like /webpack/options/?option=output/filename + if (location.pathname === '/r/webpack/') { const searchParams = new URLSearchParams(location.search); const option = searchParams.get('option') || ''; const options = option.split('/').filter(Boolean); + console.log(option, options); if (options.length === 0) return '/configuration/'; return `/configuration/${options[0]}/#${options.join('').toLowerCase()}`; } diff --git a/src/content/webpack/options.md b/src/content/r/webpack.mdx similarity index 68% rename from src/content/webpack/options.md rename to src/content/r/webpack.mdx index 77d0621542e8..a6569698a895 100644 --- a/src/content/webpack/options.md +++ b/src/content/r/webpack.mdx @@ -2,4 +2,4 @@ title: Webpack Options --- -hello webpack. +Redirecting… From c160c45501f44b0456acae72408205cd18ce1d7f Mon Sep 17 00:00:00 2001 From: chenxsan Date: Tue, 20 Jul 2021 12:22:36 +0800 Subject: [PATCH 6/9] hide r from sub navigation --- src/components/Site/Site.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Site/Site.jsx b/src/components/Site/Site.jsx index 99d9709d26a5..b0f6c12b3703 100644 --- a/src/components/Site/Site.jsx +++ b/src/components/Site/Site.jsx @@ -149,7 +149,7 @@ function Site(props) { ); // not to show in sub navbar - const excludeItems = ['contribute', 'blog']; + const excludeItems = ['contribute', 'blog', 'r']; const title = getPageTitle(Content, location.pathname); From c2385f3fc020f075f5004e32f5f6b7a9ec7e4849 Mon Sep 17 00:00:00 2001 From: chenxsan Date: Wed, 21 Jul 2021 08:39:33 +0800 Subject: [PATCH 7/9] use placeholder --- src/content/r/webpack.mdx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/content/r/webpack.mdx b/src/content/r/webpack.mdx index a6569698a895..438f32bce83a 100644 --- a/src/content/r/webpack.mdx +++ b/src/content/r/webpack.mdx @@ -1,5 +1,13 @@ --- -title: Webpack Options +title: '' +contributors: + - chenxsan --- -Redirecting… +import { PlaceholderString } from '../../components/Placeholder/Placeholder'; + +
From 84fb10c24ee0d361b2612224671da25616c72820 Mon Sep 17 00:00:00 2001 From: chenxsan Date: Fri, 23 Jul 2021 23:04:47 +0800 Subject: [PATCH 8/9] remove contributors --- src/content/r/webpack.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/content/r/webpack.mdx b/src/content/r/webpack.mdx index 438f32bce83a..21fe81b79efc 100644 --- a/src/content/r/webpack.mdx +++ b/src/content/r/webpack.mdx @@ -1,7 +1,5 @@ --- title: '' -contributors: - - chenxsan --- import { PlaceholderString } from '../../components/Placeholder/Placeholder'; From 036132dd1a83ea8dbbccc9d0056ae46b9b1aac36 Mon Sep 17 00:00:00 2001 From: chenxsan Date: Mon, 26 Jul 2021 19:45:13 +0800 Subject: [PATCH 9/9] clean up --- src/components/Site/clientSideRedirections.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Site/clientSideRedirections.js b/src/components/Site/clientSideRedirections.js index d343e1661f1a..703ec65374e7 100644 --- a/src/components/Site/clientSideRedirections.js +++ b/src/components/Site/clientSideRedirections.js @@ -14,7 +14,6 @@ export default function (location) { const searchParams = new URLSearchParams(location.search); const option = searchParams.get('option') || ''; const options = option.split('/').filter(Boolean); - console.log(option, options); if (options.length === 0) return '/configuration/'; return `/configuration/${options[0]}/#${options.join('').toLowerCase()}`; }