File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ import Container from ' @/components/Container.astro' ;
3+ import Avatar from ' @/components/ui/Avatar.astro' ;
4+ import BaseLayout from ' @/layouts/BaseLayout.astro' ;
5+ import { DEFAULT_CONFIGURATION } from ' @/lib/constants' ;
6+ import { Image } from ' astro:assets' ;
7+ import { getCollection , render } from ' astro:content' ;
8+
9+ export async function getStaticPaths() {
10+ const entries = await getCollection (' posts' );
11+
12+ return entries .map ((entry ) => ({
13+ params: { slug: entry .id },
14+ props: { entry },
15+ }));
16+ }
17+
18+ const { entry } = Astro .props ;
19+ const { Content } = await render (entry );
20+ ---
21+
22+ <BaseLayout >
23+ <Container >
24+ <article class =" flex flex-col gap-6" >
25+ <div class =" flex flex-col gap-2 pt-6" >
26+ <a href =" /writing" class =" transition-all text-muted-foreground hover:text-foreground pb-4 text-sm" >
27+ Back to writing
28+ </a >
29+ <div class =" flex flex-col gap-1.5" >
30+ <Avatar />
31+ <span class =" text-foreground" >{ DEFAULT_CONFIGURATION .author .name } </span >
32+ </div >
33+ <h1 class =" text-3xl font-semibold text-headings" >{ entry .data .title } </h1 >
34+ </div >
35+ <div class =" relative aspect-video overflow-hidden rounded-lg" >
36+ <Image
37+ src ={ entry .data .image }
38+ alt ={ entry .data .title }
39+ class =" object-cover"
40+ />
41+ </div >
42+ <div class =" prose dark:prose-invert" >
43+ <Content />
44+ </div >
45+ </article >
46+ </Container >
47+ </BaseLayout >
48+
You can’t perform that action at this time.
0 commit comments