Very first version of pantosite-astro

This commit is contained in:
Anton Pogrebnjak
2024-12-27 22:05:12 +01:00
parent f82a00b1da
commit f83c6af99b
62 changed files with 1237 additions and 654 deletions

View File

@@ -0,0 +1,22 @@
---
import { type CollectionEntry, getCollection } from 'astro:content';
import BlogPost from '../../layouts/BlogPost.astro';
import { render } from 'astro:content';
import { convertCollectionPost, convertPost, type Post } from '../../models/Post';
export async function getStaticPaths() {
const posts: Post[] = (await getCollection('projects')).map(convertPost);
return posts.map((post) => ({
params: { slug: post.id },
props: post,
}));
}
type Props = CollectionEntry<'projects'>;
const post: Post = Astro.props;
const { Content } = await render(convertCollectionPost(post));
---
<BlogPost {...post}>
<Content />
</BlogPost>

View File

@@ -0,0 +1,31 @@
---
import BaseHead from '../../components/BaseHead.astro';
import Header from '../../components/Header.astro';
import Footer from '../../components/Footer.astro';
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
import { getCollection } from 'astro:content';
import Showcase from '../../components/Showcase.astro';
import { convertPost } from '../../models/Post';
const posts: Post[] = (await getCollection('projects')).map(convertPost).sort(
(a, b) => b.pubDate.valueOf() - a.pubDate.valueOf(),
);
---
<!doctype html>
<html lang="en">
<head>
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
</head>
<body>
<Header />
<main>
{posts.length === 0 ? (
<h1 style="opacity: .5; user-select: none;">No posts yet &#128539;</h1>
) : (
<Showcase collection="projects" posts={posts} />
)}
</main>
<Footer />
</body>
</html>