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(a.data.updated || a.data.added).valueOf(),
)
.slice(0, 6);
.slice(0, 8);
---
<content>
+1 -1
View File
@@ -47,7 +47,7 @@ function getTiltDegrees() {
gap: 1em;
@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 ColorScript from "../components/ColorScript.astro";
import Tags from "../components/Tags.astro";
import Container from "../components/Container.astro";
let {
content: { title, description, added, updated, tags, heroImage },
content: { title, description, added, updated, tags, heroImage },
} = Astro.props;
added = new Date(added).toLocaleDateString(
"eu",
{
year: "numeric",
month: "short",
day: "numeric",
}
);
added = new Date(added).toLocaleDateString("eu", {
year: "numeric",
month: "short",
day: "numeric",
});
if (updated) {
updated = new Date(updated).toLocaleDateString(
"eu",
{
year: "numeric",
month: "short",
day: "numeric",
}
);
updated = new Date(updated).toLocaleDateString("eu", {
year: "numeric",
month: "short",
day: "numeric",
});
}
---
<html lang="eu">
<BaseHead title={`${title} · txarli.dev`} description={description} />
<BaseHead title={`${title} · txarli.dev`} description={description} />
<body>
<Header />
<main>
<article>
{heroImage && <img width={720} height={360} src={heroImage} alt="" />}
<h1 class="article-title">{title}</h1>
{updated ?
<p class="article-date"><time>{added}</time>, azken eguneraketa: <time>{updated}</time></p>
:
<p class="article-date">{added && <time>{added}</time>}</p>
}
<Tags tags={tags} />
<hr />
<div class="blog-post">
<slot />
</div>
</article>
</main>
<Footer />
<ColorScript />
</body>
<body>
<Container>
<Header />
<main>
<article>
{heroImage && <img width={720} height={360} src={heroImage} alt="" />}
<h1 class="article-title">{title}</h1>
{
updated ? (
<p class="article-date">
<time>{added}</time>, azken eguneraketa: <time>{updated}</time>
</p>
) : (
<p class="article-date">{added && <time>{added}</time>}</p>
)
}
<Tags tags={tags} />
<hr />
<div class="blog-post">
<slot />
</div>
</article>
</main>
<Footer />
<ColorScript />
</Container>
</body>
</html>
<style>
.article-date {
margin: 0;
font-style: italic;
color: var(--gray);
}
.article-date {
margin: 0;
font-style: italic;
color: var(--gray);
}
</style>
+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>
-1
View File
@@ -28,7 +28,6 @@
body {
margin: auto;
padding: 20px;
max-width: 70ch;
background-color: var(--white);
word-wrap: break-word;
overflow-wrap: break-word;