full site update
This commit is contained in:
@@ -1,31 +1,28 @@
|
||||
---
|
||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import { getBlogPostBySlug, getBlogPosts } from '../../utils/directus';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
// Get all blog posts to create redirects
|
||||
const { getBlogPosts } = await import('../../utils/directus');
|
||||
const posts = await getBlogPosts();
|
||||
|
||||
return posts
|
||||
.filter((post) => typeof post.slug === 'string' && post.slug.trim() !== '')
|
||||
.map((post) => ({
|
||||
params: { slug: post.slug },
|
||||
props: { post },
|
||||
props: { slug: post.slug },
|
||||
}));
|
||||
}
|
||||
|
||||
const { post } = Astro.props;
|
||||
const { slug } = Astro.props;
|
||||
---
|
||||
|
||||
<BaseLayout title={`${post.title} | Tiber365 Blog`}>
|
||||
<main class="container mx-auto px-4 py-12">
|
||||
<article class="max-w-3xl mx-auto">
|
||||
<header class="mb-8">
|
||||
<h1 class="text-4xl font-bold mb-4">{post.title}</h1>
|
||||
<p class="text-gray-600 dark:text-gray-300">
|
||||
{new Date(post.date_created).toLocaleDateString()}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div class="prose dark:prose-invert max-w-none" set:html={post.content}></div>
|
||||
</article>
|
||||
</main>
|
||||
</BaseLayout>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Redirecting...</title>
|
||||
<meta http-equiv="refresh" content="0;url=/en/blog/{slug}">
|
||||
<link rel="canonical" href="/en/blog/{slug}">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="/en/blog/{slug}">blog post</a>...</p>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user