feat: Specialize /research and /archives

This commit is contained in:
Leni Aniva 2025-07-05 20:45:04 -07:00
parent 045311168d
commit 50555eb10c
Signed by: aniva
GPG Key ID: D5F96287843E8DFB
7 changed files with 57 additions and 17 deletions

View File

@ -0,0 +1,6 @@
---
title: Research
---
# Research
I teach Lean!

View File

@ -1,8 +1,8 @@
import siteMetadata from '$content/metadata.json';
export const routes: { route: string, name: string, disabled?: boolean }[] = [
{ route: "/", name: "Home" },
{ route: "/post", name: "Blog" },
{ route: "/tag", name: "Tags" },
{ route: "/gallery", name: "Gallery", disabled: true },
].concat(siteMetadata?.extra || []);
{ route: "/research", name: "Research" },
{ route: "/archives", name: "Archives" },
]

View File

@ -1,12 +0,0 @@
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params }) => {
const post = await import(`$content/extra/${params.slug}.md`);
const Content = post.default;
return {
slug: params.slug,
metadata: post.metadata,
Content,
};
}

View File

@ -1,10 +1,10 @@
<script lang="ts">
import type { PageData } from './$types';
export let data: PageData;
const { slug, metadata, Content } = data;
const { metadata, Content } = data;
import siteMetadata from '$content/metadata.json';
const title = metadata?.title || (slug[0].toUpperCase() + slug.slice(1));
const title = metadata?.title
</script>
<svelte:head>

View File

@ -0,0 +1,14 @@
import { error } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load: PageLoad = async (_) => {
const post = await import(`$content/extra/archives.md`);
if (!post) throw error(404);
const { name } = post.metadata;
const Content = post.default;
return {
name,
Content,
};
}

View File

@ -0,0 +1,18 @@
<script lang="ts">
import type { PageData } from './$types';
export let data: PageData;
const { metadata, Content } = data;
import siteMetadata from '$content/metadata.json';
const title = metadata?.title
</script>
<svelte:head>
<title>{title} | {siteMetadata.blogName}</title>
</svelte:head>
<hr />
<article class="prose lg:prose-xl dark:prose-dark p-4">
<Content />
</article>
<hr />

View File

@ -0,0 +1,14 @@
import { error } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load: PageLoad = async (_) => {
const post = await import(`$content/extra/research.md`);
if (!post) throw error(404);
const { name } = post.metadata;
const Content = post.default;
return {
name,
Content,
};
}