Compare commits

..
2 Commits
Author SHA1 Message Date
txarli c5277f34a2 refactor: edukiak lekuz mugitzen ditu 2026-11-19 10:46:48 +01:00
txarli eebcff2a3c feat: etiketen edukia sortzen du 2026-11-19 10:44:44 +01:00
28 changed files with 37 additions and 6 deletions

No files matched your search

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
View File
@@ -0,0 +1 @@
Etiketa honekin markatu ditudan post-ek, kutxu teknikoa dute. Nire interesak, batez ere, internet eta sareetako zerbitzuak, software librea eta sistema txertatuak (Raspberry Pi Pico eta horrelakoak erabiltzea maite dut) dira. Horretaz gain, lanean (informatikako lanbide heziketako irakaslea naiz) ikasitako gauzatxoak ere jasotzen ditut.
+6 -2
View File
@@ -4,7 +4,7 @@ import { z } from "astro/zod";
import { glob } from "astro/loaders";
const posts = defineCollection({
loader: glob({ pattern: "*.md", base: "./posts" }),
loader: glob({ pattern: "*.md", base: "./content/posts" }),
schema: z.object({
title: z.string(),
slug: z.string(),
@@ -17,4 +17,8 @@ const posts = defineCollection({
}),
});
export const collections = { posts };
const tags = defineCollection({
loader: glob({ pattern: "*.md", base: "./content/tags" }),
});
export const collections = { posts, tags };
+30 -4
View File
@@ -1,5 +1,5 @@
---
import { getCollection, type CollectionEntry } from "astro:content";
import { getCollection, render, type CollectionEntry } from "astro:content";
import BaseHead from "../../components/BaseHead.astro";
import Header from "../../components/Header.astro";
import Footer from "../../components/Footer.astro";
@@ -38,6 +38,12 @@ export async function getStaticPaths() {
const { tag } = Astro.props;
const { tag: currentTag } = Astro.params;
const allTags = await getCollection("tags");
const contentTag = allTags.find(({ id }) => id === currentTag);
const Content = contentTag ? (await render(contentTag)).Content : null;
let sortedPosts = tag.sort(
(a, b) => new Date(b.data.added).valueOf() - new Date(a.data.added).valueOf(),
);
@@ -52,7 +58,18 @@ let sortedPosts = tag.sort(
</Container>
<main>
<content>
<h3>"{currentTag}" etiketarekin markatutako postak</h3>
<h1 class={Content ? "has-description" : null}>
"{currentTag}" etiketarekin markatutako postak
</h1>
{
Content && (
<Container>
<Content />
</Container>
)
}
<PostGrid posts={sortedPosts} />
</content>
</main>
@@ -63,9 +80,18 @@ let sortedPosts = tag.sort(
</body>
</html>
<style>
h3 {
<style lang="scss">
h1 {
color: var(--gray);
line-height: 1.1;
font-size: 1.17em;
margin-bottom: 2em;
margin-top: 0;
text-align: center;
font-weight: bold;
&.has-description {
margin-bottom: 1em;
}
}
</style>