Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions src/components/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import LoadingIcon from '../../styles/icons/loading.svg';
const versions = [5, 4];
const currentDocsVersion = 5;

// hide them from sidebar
// r for `redirect`
const excludedPages = ['/r/webpack/'];

Sidebar.propTypes = {
className: PropTypes.string,
pages: PropTypes.array,
Expand Down Expand Up @@ -69,26 +73,28 @@ export default function Sidebar({ className = '', pages, currentPage }) {
</div>
<Print url={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 (
<div key={page.url}>
{displayGroup ? (
<h4 className="sidebar__group">{group}</h4>
) : null}
return (
<div key={page.url}>
{displayGroup ? (
<h4 className="sidebar__group">{group}</h4>
) : null}

<SidebarItem
index={index}
url={page.url}
title={page.title}
anchors={page.anchors}
currentPage={currentPage}
/>
</div>
);
})}
<SidebarItem
index={index}
url={page.url}
title={page.title}
anchors={page.anchors}
currentPage={currentPage}
/>
</div>
);
})}
</div>
</nav>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Site/Site.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 8 additions & 0 deletions src/components/Site/clientSideRedirections.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@ export default function (location) {
) {
return `/configuration/cache/${location.hash}`;
}

if (location.pathname === '/r/webpack/') {
const searchParams = new URLSearchParams(location.search);
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;
}
11 changes: 11 additions & 0 deletions src/content/r/webpack.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: ''
---

import { PlaceholderString } from '../../components/Placeholder/Placeholder';

<div
dangerouslySetInnerHTML={{
__html: PlaceholderString(),
}}
/>