mirror of
https://github.com/valentineus/popov.link.git
synced 2025-07-04 08:30:27 +03:00
Update blog post metadata and styles
This commit is contained in:
@ -8,7 +8,10 @@ import PostSummary from "../components/PostSummary.astro";
|
||||
type Props = InferGetStaticPropsType<typeof getStaticPaths>;
|
||||
|
||||
export const getStaticPaths = (async ({ paginate }) => {
|
||||
const posts = await getCollection("blog");
|
||||
const posts = await getCollection("blog", ({ data }) => {
|
||||
return data.draft !== true;
|
||||
});
|
||||
|
||||
posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime());
|
||||
|
||||
return paginate(posts, {
|
||||
|
@ -2,11 +2,14 @@
|
||||
import { type CollectionEntry, getCollection } from "astro:content";
|
||||
import Comments from "../../components/Comments.astro";
|
||||
import Layout from "../../layouts/BaseLayout.astro";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
type Props = CollectionEntry<"blog">;
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getCollection("blog");
|
||||
const posts = await getCollection("blog", ({ data }) => {
|
||||
return data.draft !== true;
|
||||
});
|
||||
|
||||
return posts.map((post) => ({
|
||||
params: { slug: post.slug },
|
||||
@ -15,33 +18,30 @@ export async function getStaticPaths() {
|
||||
}
|
||||
|
||||
const post = Astro.props;
|
||||
const { Content, remarkPluginFrontmatter } = await post.render();
|
||||
const { Content } = await post.render();
|
||||
const formattedDate = dayjs(post.data.pubDate.toString()).format("MMMM DD, YYYY");
|
||||
---
|
||||
|
||||
<style>
|
||||
.header {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<Layout description={post.data.description} title={post.data.title}>
|
||||
<article>
|
||||
<section class="header">
|
||||
<section>
|
||||
<h1>{post.data.title}</h1>
|
||||
<p>
|
||||
<small>
|
||||
Posted
|
||||
<time datetime={post.data.pubDate.toISOString()}>{post.data.pubDate.toDateString()}</time>
|
||||
by {post.data.author} ‐
|
||||
<strong>{remarkPluginFrontmatter.minutesRead}</strong>
|
||||
</small>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<Content />
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p>
|
||||
<small>
|
||||
Posted
|
||||
<time datetime={post.data.pubDate.toISOString()}>{formattedDate}</time>
|
||||
by {post.data.author}
|
||||
</small>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<Comments />
|
||||
</section>
|
||||
|
@ -2,7 +2,9 @@ import { getCollection } from "astro:content";
|
||||
import rss from "@astrojs/rss";
|
||||
|
||||
export async function GET(context) {
|
||||
const posts = await getCollection("blog");
|
||||
const posts = await getCollection("blog", ({ data }) => {
|
||||
return data.draft !== true;
|
||||
});
|
||||
|
||||
return rss({
|
||||
customData: `<language>ru-ru</language>`,
|
||||
|
Reference in New Issue
Block a user