chore: tipadoa konpontzen du

This commit is contained in:
txarli committed 2026-11-05 14:11:49 +01:00
1 parent a866661a82
commit 3b47191d78
6 files changed
+29 -22

No files matched your search

+6 -4
View File
@@ -1,6 +1,11 @@
--- ---
import type { CollectionEntry } from "astro:content";
import Post from "../components/Post.astro"; import Post from "../components/Post.astro";
interface Props {
allPosts: CollectionEntry<'posts'>[]
}
const { allPosts } = Astro.props; const { allPosts } = Astro.props;
//.sort(() => 0.5 - Math.random()).slice(0, 3); //.sort(() => 0.5 - Math.random()).slice(0, 3);
@@ -18,10 +23,7 @@ let posts = allPosts
<ul class="posts-list"> <ul class="posts-list">
{ {
posts.map( posts.map(
({ (post) => <Post post={post} />
url,
data: { description, slug, title, tags, added: date },
}) => <Post {url} {description} {date} {slug} {title} {tags} />
) )
} }
</ul> </ul>
+12 -2
View File
@@ -1,10 +1,20 @@
--- ---
const { slug, title, tags, description, date } = Astro.props; import type { CollectionEntry } from "astro:content";
interface Props {
post: CollectionEntry<"posts">;
}
const {
post: {
data: { slug, title, tags, description, added: date },
},
}: Props = Astro.props;
--- ---
<li class="post"> <li class="post">
<a href={`/post/${slug}/`} class="title">{title}</a> <a href={`/post/${slug}/`} class="title">{title}</a>
<time datetime={date}> <time datetime={date as string}>
{ {
new Date(date).toLocaleDateString("eu", { new Date(date).toLocaleDateString("eu", {
year: "numeric", year: "numeric",
+5
View File
@@ -1,4 +1,9 @@
--- ---
interface Props {
tags: string[];
all?: boolean;
}
const { tags, all } = Astro.props; const { tags, all } = Astro.props;
--- ---
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
import { CollectionEntry, getCollection, render } from "astro:content"; import { type CollectionEntry, getCollection, render } from "astro:content";
import BlogPost from "../../layouts/BlogPost.astro"; import BlogPost from "../../layouts/BlogPost.astro";
export async function getStaticPaths() { export async function getStaticPaths() {
+1 -8
View File
@@ -25,14 +25,7 @@ posts = posts.sort(
<main> <main>
<content> <content>
<ul class="posts-list"> <ul class="posts-list">
{ {posts.map((post) => <Post post={post} />)}
posts.map(
({
url,
data: { description, slug, title, tags, added: date },
}) => <Post {description} {date} {slug} {title} {tags} />
)
}
</ul> </ul>
</content> </content>
</main> </main>
+4 -7
View File
@@ -1,5 +1,5 @@
--- ---
import { getCollection } from "astro:content"; import { getCollection, type CollectionEntry } from "astro:content";
import BaseHead from "../../components/BaseHead.astro"; import BaseHead from "../../components/BaseHead.astro";
import Header from "../../components/Header.astro"; import Header from "../../components/Header.astro";
import Footer from "../../components/Footer.astro"; import Footer from "../../components/Footer.astro";
@@ -9,8 +9,8 @@ import ColorScript from "../../components/ColorScript.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../../config"; import { SITE_TITLE, SITE_DESCRIPTION } from "../../config";
export async function getStaticPaths() { export async function getStaticPaths() {
let posts = await getCollection("posts"); const posts = await getCollection("posts");
const tags = posts.reduce((allTags, post) => { const tags = posts.reduce<Record<string, CollectionEntry<"posts">[]>>((allTags, post) => {
const postTags = post.data.tags; const postTags = post.data.tags;
if (postTags) { if (postTags) {
postTags.forEach((tag) => { postTags.forEach((tag) => {
@@ -50,10 +50,7 @@ let sortedPosts = tag.sort(
<ul class="tags-list"> <ul class="tags-list">
{ {
sortedPosts.map( sortedPosts.map(
({ (post) => <Post post={post} />
url,
data: { description, slug, title, tags, added: date },
}) => <Post {url} {description} {date} {slug} {title} {tags} />
) )
} }
</ul> </ul>