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