wiki/quartz/components/pages/404.tsx

19 lines
649 B
TypeScript
Raw Normal View History

import { i18n } from "../../i18n"
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types"
2023-09-07 04:02:21 +00:00
const NotFound: QuartzComponent = ({ cfg }: QuartzComponentProps) => {
// If baseUrl contains a pathname after the domain, use this as the home link
const url = new URL(`https://${cfg.baseUrl ?? "example.com"}`)
const baseDir = url.pathname
2023-09-07 04:02:21 +00:00
return (
<article class="popover-hint">
<h1>404</h1>
<p>{i18n(cfg.locale).pages.error.notFound}</p>
<a href={baseDir}>{i18n(cfg.locale).pages.error.home}</a>
2023-09-07 04:02:21 +00:00
</article>
)
}
export default (() => NotFound) satisfies QuartzComponentConstructor