mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-08 17:55:08 +00:00
feat(i18n): homepage link for 404 pages (#1117)
* Add homepage link with internationalization * Construct pathname from baseUrl config value * More robust URL manipulation * Add Farsi (#1133) * Fix bad rebase
This commit is contained in:
parent
81a4e20236
commit
9c726efa33
20 changed files with 24 additions and 0 deletions
quartz/components/pages
|
@ -2,10 +2,15 @@ import { i18n } from "../../i18n"
|
|||
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types"
|
||||
|
||||
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
|
||||
|
||||
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>
|
||||
</article>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue