2024-02-18 00:55:43 +04:00
|
|
|
---
|
|
|
|
// Import section components
|
2024-03-25 22:39:36 +04:00
|
|
|
import MainLayout from "@/layouts/MainLayout.astro";
|
2024-02-18 00:55:43 +04:00
|
|
|
import { Image } from "astro:assets";
|
|
|
|
import { getCollection } from "astro:content";
|
|
|
|
|
2024-02-18 07:39:17 +04:00
|
|
|
// Use `getStaticPaths` to generate static routes for generated pages on build
|
2024-02-18 00:55:43 +04:00
|
|
|
export async function getStaticPaths() {
|
|
|
|
const insightPosts = await getCollection("insights");
|
|
|
|
return insightPosts.map((post) => ({
|
|
|
|
params: { slug: post.slug },
|
|
|
|
props: { post },
|
|
|
|
}));
|
|
|
|
}
|
2024-02-18 07:39:17 +04:00
|
|
|
// Get the props for this page that define a specific insight post
|
2024-02-18 00:55:43 +04:00
|
|
|
const { post } = Astro.props;
|
|
|
|
---
|
|
|
|
|
2024-02-20 07:47:23 +04:00
|
|
|
<MainLayout title={post.data.title + " | ScrewFast"}>
|
2024-02-19 09:36:37 +04:00
|
|
|
<section class="py-6 sm:py-8 lg:py-12">
|
2024-02-18 00:55:43 +04:00
|
|
|
<div class="mx-auto max-w-screen-xl px-4 md:px-8">
|
|
|
|
<div class="grid gap-8 md:grid-cols-2 lg:gap-12">
|
|
|
|
<div>
|
|
|
|
<div class="h-64 overflow-hidden rounded-lg shadow-lg md:h-auto">
|
|
|
|
<Image
|
2024-02-18 07:39:17 +04:00
|
|
|
class="h-full w-full object-cover object-center"
|
|
|
|
src={post.data.cardImage}
|
|
|
|
alt={post.data.cardImageAlt}
|
|
|
|
draggable={"false"}
|
|
|
|
format={"avif"}
|
|
|
|
/>
|
2024-02-18 00:55:43 +04:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-02-18 07:39:17 +04:00
|
|
|
|
2024-02-18 00:55:43 +04:00
|
|
|
<div class="md:pt-8">
|
2024-02-18 07:39:17 +04:00
|
|
|
<h1
|
|
|
|
class="mb-4 text-balance text-center text-2xl font-bold text-neutral-800 dark:text-neutral-200 sm:text-3xl md:mb-6 md:text-left"
|
|
|
|
>
|
|
|
|
{post.data.title}
|
|
|
|
</h1>
|
|
|
|
<div class="space-y-8">
|
|
|
|
{
|
|
|
|
post.data.contents.map((content) => (
|
|
|
|
<p class="text-pretty text-lg text-neutral-700 dark:text-neutral-300">
|
|
|
|
{content}
|
|
|
|
</p>
|
|
|
|
))
|
|
|
|
}
|
2024-02-18 00:55:43 +04:00
|
|
|
</div>
|
2024-02-18 07:39:17 +04:00
|
|
|
</div>
|
2024-02-18 00:55:43 +04:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-02-19 09:36:37 +04:00
|
|
|
</section>
|
2024-02-18 00:55:43 +04:00
|
|
|
</MainLayout>
|