Skip to content

Commit

Permalink
Bugfix: Improve 404 consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyjshaw committed Sep 1, 2023
1 parent 426c70f commit b842110
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ const Layout = ({children, location}) => {

let {pathname} = location;
if (pathname.endsWith('/')) pathname = pathname.slice(0, -1);
const is404 = !location.key;

const isBlogPost = pathname.match(/\/blog\/.*[^0-9/]/);
if (pathname.startsWith('/blog'))
const isBlogPost = !is404 && pathname.match(/\/blog\/.*[^0-9/]/);
if (!404 && pathname.startsWith('/blog'))
pathname = isBlogPost ? '/blog/post' : '/blog';

const showPageHeader = !(isBlogPost || pathname.startsWith('/curate/'));
const showPageHeader =
is404 || !(isBlogPost || pathname.startsWith('/curate/'));
return (
<div
className={cn(
Expand Down

0 comments on commit b842110

Please sign in to comment.