Add experience pages
Some checks failed
Build and Test / determine_version (push) Successful in 6s
Build and Test / test (push) Successful in 1s
Build and Test / build_and_push (push) Has been cancelled

This commit is contained in:
2025-03-23 23:31:05 -07:00
parent b12968a3ab
commit 5d56e7eeed
2 changed files with 23 additions and 1 deletions

View File

@@ -5,6 +5,10 @@ import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
// 3. Define your collection(s)
const experiences = defineCollection({
loader: glob({ pattern: "*.md", base: "src/content/experience" })
})
const projects = defineCollection({
loader: glob({ pattern: "*.md", base: "src/content/projects" })
})
@@ -13,4 +17,4 @@ const hobbies = defineCollection({
})
// 4. Export a single `collections` object to register your collection(s)
export const collections = { projects, hobbies };
export const collections = { experiences, projects, hobbies };

View File

@@ -0,0 +1,18 @@
---
import {getCollection, render} from 'astro:content';
import BaseLayout from "../../layouts/BaseLayout.astro";
// 1. Generate a new path for every collection entry
export async function getStaticPaths() {
const experiences = await getCollection('experiences');
return experiences.map(experience => ({
params: {id: experience.id},
props: {project: experience},
}));
}
// 2. For your template, you can get the entry directly from the prop
const {experience} = Astro.props;
const {Content} = await render(experience);
---
<BaseLayout title={experience.id}>
<Content/>
</BaseLayout>