Skip to content

Commit

Permalink
Issue #207: Docs 404 is missing
Browse files Browse the repository at this point in the history
Signed-off-by: macdonst <[email protected]>
  • Loading branch information
macdonst committed Jun 4, 2024
1 parent c33ecef commit 06a173a
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions app/api/docs/$$.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { URL } from 'url'
import { Arcdown } from 'arcdown'
import arcStaticImg from 'markdown-it-arc-static-img'
import navDataLoader, {
unslug,
other as otherLinks,
} from '../../docs/nav-data.mjs'
import HljsLineWrapper from '../../docs/hljs-line-wrapper.mjs'
Expand Down Expand Up @@ -63,25 +62,7 @@ export async function get (request) {
docMarkdown = readFileSync(docURL.pathname, 'utf-8')
}
catch (_err) {
let searchTerm = null
if (!docPath.endsWith('/index')) {
const docPathParts = docPath.split('/')
searchTerm = docPathParts.pop()
searchTerm = unslug(searchTerm)
}
const initialState = {
doc: {
title: '404',
path: docPath,
html: `<docs-404 search-term="${searchTerm}"></docs-404>`,
},
otherLinks,
navData,
searchTerm,
gacode,
}

return { statusCode: 404, json: initialState }
return { location: '/404' }
}
const doc = await arcdown.render(docMarkdown)

Expand Down

0 comments on commit 06a173a

Please sign in to comment.