Compare commits
2
Commits
4db754ea16
...
c5277f34a2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5277f34a2 | ||
|
|
eebcff2a3c |
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.
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.
@@ -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.
|
||||||
@@ -4,7 +4,7 @@ import { z } from "astro/zod";
|
|||||||
import { glob } from "astro/loaders";
|
import { glob } from "astro/loaders";
|
||||||
|
|
||||||
const posts = defineCollection({
|
const posts = defineCollection({
|
||||||
loader: glob({ pattern: "*.md", base: "./posts" }),
|
loader: glob({ pattern: "*.md", base: "./content/posts" }),
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
slug: 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 };
|
||||||
@@ -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 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";
|
||||||
@@ -38,6 +38,12 @@ export async function getStaticPaths() {
|
|||||||
const { tag } = Astro.props;
|
const { tag } = Astro.props;
|
||||||
const { tag: currentTag } = Astro.params;
|
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(
|
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(),
|
||||||
);
|
);
|
||||||
@@ -52,7 +58,18 @@ let sortedPosts = tag.sort(
|
|||||||
</Container>
|
</Container>
|
||||||
<main>
|
<main>
|
||||||
<content>
|
<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} />
|
<PostGrid posts={sortedPosts} />
|
||||||
</content>
|
</content>
|
||||||
</main>
|
</main>
|
||||||
@@ -63,9 +80,18 @@ let sortedPosts = tag.sort(
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<style>
|
<style lang="scss">
|
||||||
h3 {
|
h1 {
|
||||||
|
color: var(--gray);
|
||||||
|
line-height: 1.1;
|
||||||
|
font-size: 1.17em;
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
&.has-description {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in new issue
Block a user