-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from blz-it/fix-everything
Fix Everything
- Loading branch information
Showing
13 changed files
with
418 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
// This page automatically redirects to 404 page for user's locale | ||
import { defaultLang, languages } from "~/i18n"; | ||
const langs = Object.keys(languages); | ||
--- | ||
|
||
<html lang={defaultLang}> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>404 PAGE NOT FOUND</title> | ||
<link rel="canonical" href={Astro.site} /> | ||
|
||
<noscript> | ||
<meta http-equiv="refresh" content={`0;url=/${defaultLang}/404/`} /> | ||
</noscript> | ||
|
||
<script is:inline define:vars={{ langs, defaultLang }}> | ||
const urlHasLang = langs.includes(location.pathname.split("/")[1]); | ||
|
||
// First, try to redirect to the default locale (e.g., page could be monolingual) | ||
if (!urlHasLang) { | ||
location.href = "/" + defaultLang + location.pathname; | ||
return; | ||
} | ||
|
||
// If the user's locale is not available, redirect to 404 page | ||
location.href = `/${location.pathname.split("/")[1]}/404/`; | ||
</script> | ||
</head> | ||
<body> | ||
<h1>404 PAGE NOT FOUND</h1> | ||
<a href="/">TOP PAGE</a> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.