feat: hizkuntza adierazten du gaztelerazko post-etan
This commit is contained in:
1 parent
c20983c9bb
commit
4db754ea16
8 files changed
+31
-17
No files matched your search
@@ -12,6 +12,8 @@ const posts = defineCollection({
|
||||
added: z.union([z.string(), z.date()]),
|
||||
updated: z.union([z.string(), z.date()]).optional(),
|
||||
tags: z.array(z.string()),
|
||||
heroImage: z.string().optional(),
|
||||
lang: z.enum(["es", "eu"]).optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -5,9 +5,16 @@ import Footer from "../components/Footer.astro";
|
||||
import ColorScript from "../components/ColorScript.astro";
|
||||
import Tags from "../components/Tags.astro";
|
||||
import Container from "../components/Container.astro";
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
|
||||
interface Props {
|
||||
post: CollectionEntry<"posts">;
|
||||
}
|
||||
|
||||
let {
|
||||
content: { title, description, added, updated, tags, heroImage },
|
||||
post: {
|
||||
data: { title, description, added, updated, tags, heroImage, lang = "eu" },
|
||||
},
|
||||
} = Astro.props;
|
||||
|
||||
added = new Date(added).toLocaleDateString("eu", {
|
||||
@@ -25,7 +32,7 @@ if (updated) {
|
||||
}
|
||||
---
|
||||
|
||||
<html lang="eu">
|
||||
<html lang={lang}>
|
||||
<BaseHead title={`${title} · txarli.dev`} description={description} />
|
||||
|
||||
<body>
|
||||
|
||||
@@ -3,20 +3,20 @@ import { type CollectionEntry, getCollection, render } from "astro:content";
|
||||
import BlogPost from "../../layouts/BlogPost.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts: CollectionEntry<"posts">[] = await getCollection("posts");
|
||||
const posts: CollectionEntry<"posts">[] = await getCollection("posts");
|
||||
|
||||
return posts.map((post) => {
|
||||
return {
|
||||
params: { slug: post.data.slug },
|
||||
props: { post },
|
||||
};
|
||||
});
|
||||
return posts.map((post) => {
|
||||
return {
|
||||
params: { slug: post.data.slug },
|
||||
props: { post },
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const { post } = Astro.props;
|
||||
const { Content } = await render(post);
|
||||
---
|
||||
|
||||
<BlogPost content={post.data}>
|
||||
<Content />
|
||||
<BlogPost post={post}>
|
||||
<Content />
|
||||
</BlogPost>
|
||||
Reference in new issue
Block a user