feat: hasierako post-ek zabalera osoa hartzen dute

This commit is contained in:
txarli committed 2026-11-06 12:44:00 +01:00
1 parent 2d31a98614
commit 08c1ed2895
9 files changed
+153 -120

No files matched your search

+13 -10
View File
@@ -7,6 +7,7 @@ import ColorScript from "../components/ColorScript.astro";
import Tags from "../components/Tags.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
import getTags from "../scripts/getTags";
import Container from "../components/Container.astro";
const posts = await getCollection("posts");
const tags = getTags(posts);
@@ -14,15 +15,17 @@ const tags = getTags(posts);
<!doctype html>
<html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Header title={SITE_TITLE} />
<main>
404: Ez da orria aurkitu
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Container>
<Header title={SITE_TITLE} />
<main>
404: Ez da orria aurkitu
<Tags tags={tags} all />
</main>
<Footer />
<ColorScript />
</body>
<Tags tags={tags} all />
</main>
<Footer />
<ColorScript /></Container
>
</body>
</html>
+23 -14
View File
@@ -9,6 +9,7 @@ import Tags from "../components/Tags.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
import { Content as About } from "./about.md";
import getTags from "../scripts/getTags";
import Container from "../components/Container.astro";
const posts = await getCollection("posts");
const tags = getTags(posts);
@@ -16,22 +17,30 @@ const tags = getTags(posts);
<!doctype html>
<html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Header title={SITE_TITLE} />
<main>
<About />
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Container>
<Header title={SITE_TITLE} />
</Container>
<main>
<Container>
<About />
<br />
<br />
<h3>Honatx nire azken postak</h3>
<h3>Honatx nire azken postak</h3>
</Container>
<HomePosts allPosts={posts} />
<br />
<HomePosts allPosts={posts} />
<br />
<Tags tags={tags} all />
</main>
<Footer />
<ColorScript />
</body>
<Container>
<Tags tags={tags} all />
</Container>
</main>
<Container>
<Footer />
</Container>
<ColorScript />
</body>
</html>
+13 -10
View File
@@ -7,6 +7,7 @@ import Post from "../../components/Post.astro";
import ColorScript from "../../components/ColorScript.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../../config";
import Container from "../../components/Container.astro";
let posts = await getCollection("posts");
@@ -21,15 +22,17 @@ posts = posts.sort(
<html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Header />
<main>
<content>
<ul class="posts-list">
{posts.map((post) => <Post post={post} />)}
</ul>
</content>
</main>
<Footer />
<ColorScript />
<Container>
<Header />
<main>
<content>
<ul class="posts-list">
{posts.map((post) => <Post post={post} />)}
</ul>
</content>
</main>
<Footer />
<ColorScript /></Container
>
</body>
</html>
+41 -39
View File
@@ -7,56 +7,58 @@ import Post from "../../components/Post.astro";
import ColorScript from "../../components/ColorScript.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../../config";
import Container from "../../components/Container.astro";
export async function getStaticPaths() {
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) => {
if (!allTags[tag]) {
allTags[tag] = [];
}
allTags[tag].push(post);
});
}
return allTags;
}, {});
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) => {
if (!allTags[tag]) {
allTags[tag] = [];
}
allTags[tag].push(post);
});
}
return allTags;
},
{},
);
return Object.keys(tags).map((t) => {
return {
params: { tag: t },
props: { tag: tags[t] },
};
});
return Object.keys(tags).map((t) => {
return {
params: { tag: t },
props: { tag: tags[t] },
};
});
}
const { tag } = Astro.props;
const { tag: currentTag } = Astro.params;
let sortedPosts = tag.sort(
(a, b) => new Date(b.data.added).valueOf() - new Date(a.data.added).valueOf(),
(a, b) => new Date(b.data.added).valueOf() - new Date(a.data.added).valueOf(),
);
---
<!DOCTYPE html>
<!doctype html>
<html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Header />
<main>
<content>
<h3>"{currentTag}" etiketa daukaten postak</h3>
<ul class="tags-list">
{
sortedPosts.map(
(post) => <Post post={post} />
)
}
</ul>
</content>
<Footer />
</main>
<ColorScript />
</body>
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Container>
<Header />
<main>
<content>
<h3>"{currentTag}" etiketa daukaten postak</h3>
<ul class="tags-list">
{sortedPosts.map((post) => <Post post={post} />)}
</ul>
</content>
<Footer />
</main>
<ColorScript />
</Container>
</body>
</html>