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