Skip to content

Fixes wrong breadcrumb for 404 page #4074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 10, 2021
Merged
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
2 changes: 1 addition & 1 deletion beta/plugins/md-layout-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const fm = require('gray-matter');
module.exports = async function (src) {
const callback = this.async();
const {content, data} = fm(src);
const layout = data.layout || 'Learn';
const layout = data.layout || 'Home';
const code =
`import withLayout from 'components/Layout/Layout${layout}';

Expand Down
5 changes: 5 additions & 0 deletions beta/src/components/Layout/useRouteMeta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export function useRouteMeta(rootRoute?: RouteItem) {
const routeTree = rootRoute || sidebarContext;
const router = useRouter();
const cleanedPath = router.pathname;
if (cleanedPath === '/404') {
return {
breadcrumbs: [],
};
}
const breadcrumbs = getBreadcrumbs(cleanedPath, routeTree);
return {
...getRouteMeta(cleanedPath, routeTree),
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/add-react-to-a-website.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Add React to a Website
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/adding-interactivity.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Adding Interactivity
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/choosing-the-state-structure.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Choosing the State Structure
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/conditional-rendering.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Conditional Rendering
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/describing-the-ui.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Describing the UI
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/editor-setup.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Editor Setup
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/escape-hatches.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Escape Hatches
layout: Learn
---

This chapter is incomplete and is still being written!
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Extracting State Logic into a Reducer
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/importing-and-exporting-components.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Importing and Exporting Components
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Quick Start
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/installation.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Installation
layout: Learn
---

<Intro>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: JavaScript in JSX with Curly Braces
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/keeping-components-pure.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Keeping Components Pure
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/managing-state.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Managing State
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/manipulating-the-dom-with-refs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: 'Manipulating the DOM with Refs'
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/passing-data-deeply-with-context.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Passing Data Deeply with Context
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/passing-props-to-a-component.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Passing Props to a Component
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/preserving-and-resetting-state.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Preserving and Resetting State
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/queueing-a-series-of-state-updates.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Queueing a Series of State Updates
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/react-developer-tools.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: React Developer Tools
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/reacting-to-input-with-state.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Reacting to Input with State
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/referencing-values-with-refs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: 'Referencing Values with Refs'
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/render-and-commit.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Render and Commit
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/rendering-lists.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Rendering Lists
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/responding-to-events.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Responding to Events
layout: Learn
---

<Intro>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Scaling Up with Reducer and Context
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/sharing-state-between-components.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Sharing State Between Components
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/start-a-new-react-project.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Start a New React Project
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/state-a-components-memory.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "State: A Component's Memory"
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/state-as-a-snapshot.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: State as a Snapshot
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/thinking-in-react.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Thinking in React
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/updating-arrays-in-state.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Updating Arrays in State
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/updating-objects-in-state.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Updating Objects in State
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/writing-markup-with-jsx.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Writing Markup with JSX
layout: Learn
---

<Intro>
Expand Down
1 change: 1 addition & 0 deletions beta/src/pages/learn/your-first-component.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Your First Component
layout: Learn
---

<Intro>
Expand Down