feat: add some stuff

This commit is contained in:
2024-03-28 18:30:52 +01:00
parent 31b24de86c
commit d4128840b9
196 changed files with 3393 additions and 390 deletions

View File

@ -11,7 +11,6 @@ export async function getStaticPaths() {
const paths = pages.map((page) => {
const [slug] = parseSlug(page.id);
return { params: { slug }, props: { ...page } };
});
@ -24,6 +23,12 @@ const page = filterCollection(pages, locale).find((page) => {
return slug === Astro.params.slug;
});
if (!page) {
return new Response("Not found", {
status: 404,
});
}
const { Content } = await page.render();
---

View File

@ -16,10 +16,8 @@ const posts = filterCollection(pages, locale);
{
posts.map((post) => (
<>
<>
<a href={"blog/" + post.slug.split("/")[0]}>{post.data.title}</a>
<br />
</>
<a href={"blog/" + post.slug.split("/")[0]}>{post.data.title}</a>
<br />
</>
))
}

View File

@ -1,8 +1,54 @@
---
import Layout from "@layouts/Layout.astro";
import Max from "@components/Max.astro";
import { Card } from "@components/card";
import { getCollection } from "astro:content";
import { filterCollection, useTranslatedPath } from "@i18n/utils";
import markdownToText from "@helpers/markdownToText";
import { getLocale } from "astro-i18n-aut";
const projects = filterCollection(
await getCollection("projects"),
getLocale(Astro.url),
);
const translatePath = useTranslatedPath(Astro);
const locale = getLocale(Astro.url);
const projectSlides = await Promise.all(
projects.map(async (project) => ({
title: project.data.title,
description: markdownToText(project.body),
image: project.data.headerImg,
link: translatePath(project.slug),
})),
);
const featuredProject = projects.find((project) => project.data?.featured);
---
<Layout title="dude">
<Layout title="Max Richter">
<Max />
{
featuredProject && (
<Card classes="flex overflow-hidden gradient border-1 border-light">
<Card.Content classes="p-8">
<Card.Title>{featuredProject.data.title}</Card.Title>
<Card.Description>
{markdownToText(featuredProject.body).slice(0, 200)}
</Card.Description>
<Card.ReadMoreButton
link={translatePath(
`/projects/${featuredProject.slug.split("/")[0]}`,
)}
/>
</Card.Content>
<Card.Image
src={featuredProject.data.headerImg}
alt={featuredProject.data.title}
/>
</Card>
)
}
</Layout>

View File

@ -0,0 +1,37 @@
---
import { getCollection } from "astro:content";
import Post from "@layouts/Post.astro";
import { getLocale } from "astro-i18n-aut";
import { filterCollection, parseSlug } from "@i18n/utils";
const locale = getLocale(Astro.url);
export async function getStaticPaths() {
const pages = await getCollection("photos");
const paths = pages.map((page) => {
const [slug] = parseSlug(page.id);
return { params: { slug }, props: { ...page } };
});
return paths;
}
const pages = await getCollection("photos");
const page = filterCollection(pages, locale).find((page) => {
const [slug] = parseSlug(page.id);
return slug === Astro.params.slug;
});
if (!page) {
return new Response("Not found", {
status: 404,
});
}
const { Content } = await page.render();
---
<Post {...page.data} backlink="/photos">
<Content />
</Post>

View File

@ -0,0 +1,25 @@
---
import { getCollection } from "astro:content";
import Layout from "@layouts/Layout.astro";
import { getLocale } from "astro-i18n-aut";
import { filterCollection } from "@i18n/utils";
const locale = getLocale(Astro.url);
const pages = await getCollection("photos");
const posts = filterCollection(pages, locale);
---
<Layout title="Dude">
<hr />
{
posts.map((post) => (
<>
<>
<a href={"photos/" + post.slug.split("/")[0]}>{post.data.title}</a>
<br />
</>
</>
))
}
<hr />
</Layout>

View File

@ -0,0 +1,37 @@
---
import { getCollection } from "astro:content";
import Post from "@layouts/Post.astro";
import { getLocale } from "astro-i18n-aut";
import { filterCollection, parseSlug } from "@i18n/utils";
const locale = getLocale(Astro.url);
export async function getStaticPaths() {
const pages = await getCollection("projects");
const paths = pages.map((page) => {
const [slug] = parseSlug(page.id);
return { params: { slug }, props: { ...page } };
});
return paths;
}
const pages = await getCollection("projects");
const page = filterCollection(pages, locale).find((page) => {
const [slug] = parseSlug(page.id);
return slug === Astro.params.slug;
});
if (!page) {
return new Response("Not found", {
status: 404,
});
}
const { Content } = await page.render();
---
<Post {...page.data} backlink="/projects">
<Content />
</Post>

View File

@ -0,0 +1,25 @@
---
import { getCollection } from "astro:content";
import Layout from "@layouts/Layout.astro";
import { getLocale } from "astro-i18n-aut";
import { filterCollection } from "@i18n/utils";
const locale = getLocale(Astro.url);
const pages = await getCollection("projects");
const posts = filterCollection(pages, locale);
---
<Layout title="Dude">
<hr />
{
posts.map((post) => (
<>
<>
<a href={"projects/" + post.slug.split("/")[0]}>{post.data.title}</a>
<br />
</>
</>
))
}
<hr />
</Layout>