0
mirror of https://github.com/valentineus/popov.link.git synced 2025-07-04 08:30:27 +03:00

Refactor Analytics and Head components

This commit is contained in:
2024-09-12 22:57:55 +00:00
parent b16d8ce36c
commit 33c9464dad
6 changed files with 33 additions and 18 deletions

View File

@ -5,6 +5,8 @@ import Layout from "../layouts/BaseLayout.astro";
import Pagination from "../components/Pagination.astro";
import PostSummary from "../components/PostSummary.astro";
type Props = InferGetStaticPropsType<typeof getStaticPaths>;
export const getStaticPaths = (async ({ paginate }) => {
const posts = await getCollection("blog");
posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime());
@ -14,8 +16,6 @@ export const getStaticPaths = (async ({ paginate }) => {
});
}) satisfies GetStaticPaths;
type Props = InferGetStaticPropsType<typeof getStaticPaths>;
const { page } = Astro.props;
---
@ -25,6 +25,6 @@ const { page } = Astro.props;
</section>
<section>
<Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
<Pagination nextUrl={page.url.next} prevUrl={page.url.prev} />
</section>
</Layout>

View File

@ -3,6 +3,8 @@ import { type CollectionEntry, getCollection } from "astro:content";
import Comments from "../../components/Comments.astro";
import Layout from "../../layouts/BaseLayout.astro";
type Props = CollectionEntry<"blog">;
export async function getStaticPaths() {
const posts = await getCollection("blog");
@ -12,8 +14,6 @@ export async function getStaticPaths() {
}));
}
type Props = CollectionEntry<"blog">;
const post = Astro.props;
const { Content, remarkPluginFrontmatter } = await post.render();
---
@ -24,7 +24,7 @@ const { Content, remarkPluginFrontmatter } = await post.render();
}
</style>
<Layout title={post.data.title} description={post.data.description}>
<Layout description={post.data.description} title={post.data.title}>
<article>
<section class="header">
<h1>{post.data.title}</h1>