-
-
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.
feat: add 404 and 5xx error handling
- Loading branch information
Showing
18 changed files
with
262 additions
and
174 deletions.
There are no files selected for viewing
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
import type { SeoMetadata } from "@const/types"; | ||
import BaseLayout from "@modules/core/components/baseLayout/BaseLayout.astro"; | ||
import ErrorLayer from "@modules/core/components/errorLayer/ErrorLayer.astro"; | ||
const title = "404: Not Found"; | ||
const description = "It seems you've stumbled upon a page that doesn't exist."; | ||
const metadata: Partial<SeoMetadata> = { | ||
title, | ||
description, | ||
robots: { | ||
index: false, | ||
follow: false, | ||
}, | ||
}; | ||
--- | ||
<BaseLayout {...metadata}> | ||
<ErrorLayer> | ||
<h1>{title}</h1> | ||
<p>{description}</p> | ||
</ErrorLayer> | ||
</BaseLayout> |
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,28 @@ | ||
--- | ||
import type { SeoMetadata } from "@const/types"; | ||
import BaseLayout from "@modules/core/components/baseLayout/BaseLayout.astro"; | ||
import ErrorLayer from "@modules/core/components/errorLayer/ErrorLayer.astro"; | ||
interface FiveHundredProps { | ||
error: unknown; | ||
} | ||
const { error } = Astro.props as FiveHundredProps; | ||
const title = "500: Whoops!"; | ||
const description = `For full transparency this is the error: ${error instanceof Error ? error.message : "Unknown error"}`; | ||
const metadata: Partial<SeoMetadata> = { | ||
title, | ||
description, | ||
robots: { | ||
index: false, | ||
follow: false, | ||
}, | ||
}; | ||
--- | ||
<BaseLayout {...metadata}> | ||
<ErrorLayer> | ||
<h1>{title}</h1> | ||
<p>Clearly something went wrong... Oh gosh this is embarrassing...</p> | ||
<p>{description}</p> | ||
</ErrorLayer> | ||
</BaseLayout> |
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 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
Binary file not shown.
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,8 @@ | ||
--- | ||
import "./error-layer.css"; | ||
--- | ||
<section class="error-layer__wrapper common-wrapper flex column-nowrap justify-center align-center"> | ||
<slot /> | ||
<p>Why not try going back to the <a href="/" class="link">homepage</a>?</p> | ||
</section> | ||
<div class="travolta" /> |
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,17 @@ | ||
.error-layer__wrapper { | ||
height: 100vh; | ||
position: relative; | ||
text-align: center; | ||
translate: 0 -25%; | ||
width: 100vw; | ||
z-index: 1; | ||
} | ||
|
||
.travolta { | ||
background: url('https://assets-9gag-fun.9cache.com/s/fab0aa49/033037194a549b0bf83e2ac4ba90706a52a9132e/static/dist/web6/img/404/bg.gif') center center / cover no-repeat; | ||
height: 120%; | ||
inset: 0; | ||
opacity: 0.5; | ||
position: absolute; | ||
width: 100%; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
import { TWITTER_HANDLE } from "astro:env/client"; | ||
import { DEFAULT_SEO_PARAMS } from "@const/index"; | ||
import type { SeoMetadata } from "@const/types"; | ||
type SeoProps = SeoMetadata; | ||
const canonical = new URL(Astro.url.pathname, Astro.site); | ||
const { IMAGE, TITLE, DESCRIPTION, ROBOTS } = DEFAULT_SEO_PARAMS; | ||
const { | ||
title = TITLE, | ||
description = DESCRIPTION, | ||
image = IMAGE, | ||
robots = { ...ROBOTS, ...Astro.props.robots }, | ||
} = Astro.props as SeoProps; | ||
--- | ||
<title>{title} | Bianca Fiore</title> | ||
<meta name="generator" content={Astro.generator} /> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1" /> | ||
<meta name="color-scheme" content="light dark"> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | ||
<link rel="canonical" href={canonical} /> | ||
<link rel="sitemap" href="/sitemap-index.xml" /> | ||
<meta name="title" content={title} /> | ||
<meta name="robots" content={`${robots.index ? 'index' : 'noindex'}, ${robots.follow ? 'follow' : 'nofollow'}`} /> | ||
<meta name="googlebot" content={`${robots.index ? 'index' : 'noindex'}, ${robots.follow ? 'follow' : 'nofollow'}`} /> | ||
<meta name="description" content={description} /> | ||
<meta property="og:type" content="website" /> | ||
<meta property="og:url" content={Astro.url} /> | ||
<meta property="og:title" content={title} /> | ||
<meta property="og:description" content={description} /> | ||
<meta property="og:image" content={new URL(image, Astro.url)} /> | ||
<meta property="twitter:card" content="summary_large_image" /> | ||
<meta property="twitter:url" content={Astro.url} /> | ||
<meta property="twitter:title" content={title} /> | ||
<meta property="twitter:description" content={description} /> | ||
<meta property="twitter:image" content={new URL(image, Astro.url)} /> | ||
<meta property="twitter:creator" content={TWITTER_HANDLE} /> | ||
<meta property="twitter:site" content={TWITTER_HANDLE} /> |
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 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 |
---|---|---|
@@ -1,2 +1 @@ | ||
@import url('swiper/css/bundle'); | ||
@import url('vanilla-cookieconsent/dist/cookieconsent.css'); |
Oops, something went wrong.