Added 404 page

It works ? I think... XD
This commit is contained in:
Cyril Šebek 2024-06-04 13:11:12 +02:00
parent 151a72584b
commit 17da115193
Signed by: blboun3
SSH Key Fingerprint: SHA256:ESaOKDAPaR/9j4DJ3sU4VdxTcL7qWUxpAyPSK2LLKbY
5 changed files with 23 additions and 4 deletions

View File

@ -8,7 +8,6 @@ import {
} from "./ui/card"; } from "./ui/card";
const { post, lang } = Astro.props; const { post, lang } = Astro.props;
// Astro.url.toString().split("/").slice(0,-2).concat(post.slug).join("/").split("/").slice(0,-1).join("/")
--- ---
<div> <div>

View File

@ -0,0 +1,19 @@
---
import MainLayout from "../layouts/MainLayout.astro";
import SinglePage from "../layouts/SinglePage.astro";
---
<MainLayout
title="Error 404"
,
description="This page doesn't exists"
,
lang="en"
>
<SinglePage>
<div class="text-2xl text-center h-[80vh] grid place-content-center">
<p class="text-accent">It looks like this page doesn't exists!</p>
<a href={Astro.url.origin} class="text-blue-500">Home</a>
</div>
</SinglePage>
</MainLayout>

View File

@ -29,6 +29,7 @@ const { Content } = await page.render();
class="prose prose-moi m-[auto] sm:prose-sm md:prose-md xl:prose-lg text-justify" class="prose prose-moi m-[auto] sm:prose-sm md:prose-md xl:prose-lg text-justify"
> >
<div class="text-center"> <div class="text-center">
<!--<img src={page.data.image.url} alt={page.data.image.alt} class="rounded-lg max-h-[25vh] m-auto"> -->
<h1 class="lg:text-4xl text-2xl">{page.data.title}</h1> <h1 class="lg:text-4xl text-2xl">{page.data.title}</h1>
<p>{page.data.author} • {formattedDate}</p> <p>{page.data.author} • {formattedDate}</p>
</div> </div>

View File

@ -22,7 +22,7 @@ var filtered_posts = posts.filter(
<MainLayout title={title} description={description} lang={Astro.currentLocale}> <MainLayout title={title} description={description} lang={Astro.currentLocale}>
<SinglePageBlogMode> <SinglePageBlogMode>
<PostsList filteredPosts={filtered_posts} /> <PostsList filteredPosts={filtered_posts} lang={Astro.currentLocale} />
</div> </div>
</SinglePageBlogMode> </SinglePageBlogMode>
</MainLayout> </MainLayout>

View File

@ -7,7 +7,7 @@ import PostsList from "../../../../components/PostsList.astro";
export async function getStaticPaths() { export async function getStaticPaths() {
const allPosts = await getBlogPosts(); const allPosts = await getBlogPosts();
const tags = ["test", "astro", "javascript"]; const tags = [...new Set(allPosts.map((post) => post.data.tags).flat())];
var paths = []; var paths = [];
@ -31,6 +31,6 @@ const filteredPosts = posts.filter((post) => post.data.tags?.includes(tag) && po
<MainLayout title={tag} description={"desc"} lang={lang}> <MainLayout title={tag} description={"desc"} lang={lang}>
<SinglePageBlogMode> <SinglePageBlogMode>
<PostsList filteredPosts={filteredPosts} /> <PostsList filteredPosts={filteredPosts} lang={Astro.currentLocale} />
</SinglePageBlogMode> </SinglePageBlogMode>
</MainLayout> </MainLayout>