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
+59 -26

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);
}
}
+14 -13
View File
@@ -4,29 +4,24 @@ 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 },
} = Astro.props;
added = new Date(added).toLocaleDateString(
"eu",
{
added = new Date(added).toLocaleDateString("eu", {
year: "numeric",
month: "short",
day: "numeric",
}
);
});
if (updated) {
updated = new Date(updated).toLocaleDateString(
"eu",
{
updated = new Date(updated).toLocaleDateString("eu", {
year: "numeric",
month: "short",
day: "numeric",
}
);
});
}
---
@@ -34,15 +29,20 @@ if (updated) {
<BaseHead title={`${title} · txarli.dev`} description={description} />
<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>
:
{
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 />
@@ -53,6 +53,7 @@ if (updated) {
</main>
<Footer />
<ColorScript />
</Container>
</body>
</html>
+4 -1
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);
@@ -16,6 +17,7 @@ const tags = getTags(posts);
<html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Container>
<Header title={SITE_TITLE} />
<main>
404: Ez da orria aurkitu
@@ -23,6 +25,7 @@ const tags = getTags(posts);
<Tags tags={tags} all />
</main>
<Footer />
<ColorScript />
<ColorScript /></Container
>
</body>
</html>
+9
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);
@@ -18,20 +19,28 @@ const tags = getTags(posts);
<html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Container>
<Header title={SITE_TITLE} />
</Container>
<main>
<Container>
<About />
<br />
<h3>Honatx nire azken postak</h3>
</Container>
<HomePosts allPosts={posts} />
<br />
<Container>
<Tags tags={tags} all />
</Container>
</main>
<Container>
<Footer />
</Container>
<ColorScript />
</body>
</html>
+4 -1
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,6 +22,7 @@ posts = posts.sort(
<html lang="eu">
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<body>
<Container>
<Header />
<main>
<content>
@@ -30,6 +32,7 @@ posts = posts.sort(
</content>
</main>
<Footer />
<ColorScript />
<ColorScript /></Container
>
</body>
</html>
+10 -8
View File
@@ -7,10 +7,12 @@ 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 tags = posts.reduce<Record<string, CollectionEntry<"posts">[]>>(
(allTags, post) => {
const postTags = post.data.tags;
if (postTags) {
postTags.forEach((tag) => {
@@ -21,7 +23,9 @@ export async function getStaticPaths() {
});
}
return allTags;
}, {});
},
{},
);
return Object.keys(tags).map((t) => {
return {
@@ -39,24 +43,22 @@ let sortedPosts = tag.sort(
);
---
<!DOCTYPE html>
<!doctype html>
<html lang="eu">
<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} />
)
}
{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;