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

+16
View File
@@ -0,0 +1,16 @@
<div class="container">
<div class="content">
<slot />
</div>
</div>
<style>
.container {
display: flex;
justify-content: center;
}
.content {
max-width: 70ch;
}
</style>
+1 -1
View File
@@ -17,7 +17,7 @@ let posts = allPosts
new Date(b.data.updated || b.data.added).valueOf() - new Date(b.data.updated || b.data.added).valueOf() -
new Date(a.data.updated || a.data.added).valueOf(), new Date(a.data.updated || a.data.added).valueOf(),
) )
.slice(0, 6); .slice(0, 8);
--- ---
<content> <content>
+1 -1
View File
@@ -47,7 +47,7 @@ function getTiltDegrees() {
gap: 1em; gap: 1em;
@media (min-width: 1024px) { @media (min-width: 1024px) {
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(4, 1fr);
} }
} }
+45 -44
View File
@@ -4,62 +4,63 @@ import Header from "../components/Header.astro";
import Footer from "../components/Footer.astro"; import Footer from "../components/Footer.astro";
import ColorScript from "../components/ColorScript.astro"; import ColorScript from "../components/ColorScript.astro";
import Tags from "../components/Tags.astro"; import Tags from "../components/Tags.astro";
import Container from "../components/Container.astro";
let { let {
content: { title, description, added, updated, tags, heroImage }, content: { title, description, added, updated, tags, heroImage },
} = Astro.props; } = Astro.props;
added = new Date(added).toLocaleDateString( added = new Date(added).toLocaleDateString("eu", {
"eu", year: "numeric",
{ month: "short",
year: "numeric", day: "numeric",
month: "short", });
day: "numeric",
}
);
if (updated) { if (updated) {
updated = new Date(updated).toLocaleDateString( updated = new Date(updated).toLocaleDateString("eu", {
"eu", year: "numeric",
{ month: "short",
year: "numeric", day: "numeric",
month: "short", });
day: "numeric",
}
);
} }
--- ---
<html lang="eu"> <html lang="eu">
<BaseHead title={`${title} · txarli.dev`} description={description} /> <BaseHead title={`${title} · txarli.dev`} description={description} />
<body> <body>
<Header /> <Container>
<main> <Header />
<article> <main>
{heroImage && <img width={720} height={360} src={heroImage} alt="" />} <article>
<h1 class="article-title">{title}</h1> {heroImage && <img width={720} height={360} src={heroImage} alt="" />}
{updated ? <h1 class="article-title">{title}</h1>
<p class="article-date"><time>{added}</time>, azken eguneraketa: <time>{updated}</time></p> {
: updated ? (
<p class="article-date">{added && <time>{added}</time>}</p> <p class="article-date">
} <time>{added}</time>, azken eguneraketa: <time>{updated}</time>
<Tags tags={tags} /> </p>
<hr /> ) : (
<div class="blog-post"> <p class="article-date">{added && <time>{added}</time>}</p>
<slot /> )
</div> }
</article> <Tags tags={tags} />
</main> <hr />
<Footer /> <div class="blog-post">
<ColorScript /> <slot />
</body> </div>
</article>
</main>
<Footer />
<ColorScript />
</Container>
</body>
</html> </html>
<style> <style>
.article-date { .article-date {
margin: 0; margin: 0;
font-style: italic; font-style: italic;
color: var(--gray); color: var(--gray);
} }
</style> </style>
+13 -10
View File
@@ -7,6 +7,7 @@ import ColorScript from "../components/ColorScript.astro";
import Tags from "../components/Tags.astro"; import Tags from "../components/Tags.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../config"; import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
import getTags from "../scripts/getTags"; import getTags from "../scripts/getTags";
import Container from "../components/Container.astro";
const posts = await getCollection("posts"); const posts = await getCollection("posts");
const tags = getTags(posts); const tags = getTags(posts);
@@ -14,15 +15,17 @@ const tags = getTags(posts);
<!doctype html> <!doctype html>
<html lang="eu"> <html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body> <body>
<Header title={SITE_TITLE} /> <Container>
<main> <Header title={SITE_TITLE} />
404: Ez da orria aurkitu <main>
404: Ez da orria aurkitu
<Tags tags={tags} all /> <Tags tags={tags} all />
</main> </main>
<Footer /> <Footer />
<ColorScript /> <ColorScript /></Container
</body> >
</body>
</html> </html>
+23 -14
View File
@@ -9,6 +9,7 @@ import Tags from "../components/Tags.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../config"; import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
import { Content as About } from "./about.md"; import { Content as About } from "./about.md";
import getTags from "../scripts/getTags"; import getTags from "../scripts/getTags";
import Container from "../components/Container.astro";
const posts = await getCollection("posts"); const posts = await getCollection("posts");
const tags = getTags(posts); const tags = getTags(posts);
@@ -16,22 +17,30 @@ const tags = getTags(posts);
<!doctype html> <!doctype html>
<html lang="eu"> <html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body> <body>
<Header title={SITE_TITLE} /> <Container>
<main> <Header title={SITE_TITLE} />
<About /> </Container>
<main>
<Container>
<About />
<br /> <br />
<h3>Honatx nire azken postak</h3> <h3>Honatx nire azken postak</h3>
</Container>
<HomePosts allPosts={posts} /> <HomePosts allPosts={posts} />
<br /> <br />
<Tags tags={tags} all /> <Container>
</main> <Tags tags={tags} all />
<Footer /> </Container>
<ColorScript /> </main>
</body> <Container>
<Footer />
</Container>
<ColorScript />
</body>
</html> </html>
+13 -10
View File
@@ -7,6 +7,7 @@ import Post from "../../components/Post.astro";
import ColorScript from "../../components/ColorScript.astro"; import ColorScript from "../../components/ColorScript.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../../config"; import { SITE_TITLE, SITE_DESCRIPTION } from "../../config";
import Container from "../../components/Container.astro";
let posts = await getCollection("posts"); let posts = await getCollection("posts");
@@ -21,15 +22,17 @@ posts = posts.sort(
<html lang="eu"> <html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body> <body>
<Header /> <Container>
<main> <Header />
<content> <main>
<ul class="posts-list"> <content>
{posts.map((post) => <Post post={post} />)} <ul class="posts-list">
</ul> {posts.map((post) => <Post post={post} />)}
</content> </ul>
</main> </content>
<Footer /> </main>
<ColorScript /> <Footer />
<ColorScript /></Container
>
</body> </body>
</html> </html>
+41 -39
View File
@@ -7,56 +7,58 @@ import Post from "../../components/Post.astro";
import ColorScript from "../../components/ColorScript.astro"; import ColorScript from "../../components/ColorScript.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../../config"; import { SITE_TITLE, SITE_DESCRIPTION } from "../../config";
import Container from "../../components/Container.astro";
export async function getStaticPaths() { export async function getStaticPaths() {
const posts = await getCollection("posts"); const posts = await getCollection("posts");
const tags = posts.reduce<Record<string, CollectionEntry<"posts">[]>>((allTags, post) => { const tags = posts.reduce<Record<string, CollectionEntry<"posts">[]>>(
const postTags = post.data.tags; (allTags, post) => {
if (postTags) { const postTags = post.data.tags;
postTags.forEach((tag) => { if (postTags) {
if (!allTags[tag]) { postTags.forEach((tag) => {
allTags[tag] = []; if (!allTags[tag]) {
} allTags[tag] = [];
allTags[tag].push(post); }
}); allTags[tag].push(post);
} });
return allTags; }
}, {}); return allTags;
},
{},
);
return Object.keys(tags).map((t) => { return Object.keys(tags).map((t) => {
return { return {
params: { tag: t }, params: { tag: t },
props: { tag: tags[t] }, props: { tag: tags[t] },
}; };
}); });
} }
const { tag } = Astro.props; const { tag } = Astro.props;
const { tag: currentTag } = Astro.params; const { tag: currentTag } = Astro.params;
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(),
); );
--- ---
<!DOCTYPE html> <!doctype html>
<html lang="eu"> <html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body> <body>
<Header /> <Container>
<main> <Header />
<content> <main>
<h3>"{currentTag}" etiketa daukaten postak</h3> <content>
<ul class="tags-list"> <h3>"{currentTag}" etiketa daukaten postak</h3>
{ <ul class="tags-list">
sortedPosts.map( {sortedPosts.map((post) => <Post post={post} />)}
(post) => <Post post={post} /> </ul>
) </content>
} <Footer />
</ul> </main>
</content> <ColorScript />
<Footer /> </Container>
</main> </body>
<ColorScript />
</body>
</html> </html>
-1
View File
@@ -28,7 +28,6 @@
body { body {
margin: auto; margin: auto;
padding: 20px; padding: 20px;
max-width: 70ch;
background-color: var(--white); background-color: var(--white);
word-wrap: break-word; word-wrap: break-word;
overflow-wrap: break-word; overflow-wrap: break-word;