feat(404): add collections 404 page to tech spotlights

This commit is contained in:
Khinshan Khan
2020-01-26 12:33:31 -05:00
committed by Jean-Philippe Sirois
parent a796facdb1
commit 849bd0be02
3 changed files with 38 additions and 2 deletions
+4
View File
@@ -170,6 +170,10 @@ exports.onCreatePage = async ({ page, actions }) => {
const oldPage = { ...page } const oldPage = { ...page }
page.matchPath = `/resources/*` page.matchPath = `/resources/*`
deletePage(oldPage) deletePage(oldPage)
} else if (page.path.match(/^\/archives\/404/)) {
const oldPage = { ...page }
page.matchPath = `/archives/*`
deletePage(oldPage)
} else { } else {
page.context.layout = resolveLayout(page.path) page.context.layout = resolveLayout(page.path)
} }
+32
View File
@@ -0,0 +1,32 @@
import { Location } from "@reach/router"
import { graphql } from "gatsby"
import React, { Fragment } from "react"
import { FileConnection } from "../../../generated/graphql"
import { ComponentQuery } from "../../../typings"
import { SEO } from "../../components/SEO"
import { getPossibleCorrections } from "../../components/404LinkCorrection"
export default ({ data }: ComponentQuery<{ allFile: FileConnection }>) => (
<Fragment>
<SEO title="404: Archive Not found" />
<h1>RESOURCE NOT FOUND</h1>
<p>You just hit a route that doesn&#39;t exist... the sadness.</p>
<Location>
{({ location }) => getPossibleCorrections("archives/", location, data, 8)}
</Location>
</Fragment>
)
export const query = graphql`
query {
allFile(filter: { sourceInstanceName: { eq: "what-is-archive" } }) {
edges {
node {
relativePath
}
}
}
}
`
@@ -1,7 +1,7 @@
import React, { Fragment } from "react" import React, { Fragment } from "react"
import { Link } from "../components/Link" import { Link } from "../../components/Link"
import { SEO } from "../components/SEO" import { SEO } from "../../components/SEO"
function ArchivesPage() { function ArchivesPage() {
return ( return (