feat: Custom extras page
This commit is contained in:
parent
568c1b740f
commit
e505cc92cf
|
@ -1,3 +0,0 @@
|
||||||
# Archives
|
|
||||||
|
|
||||||
Archives live here
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
title: Archives Custom Title
|
||||||
|
---
|
||||||
|
# Archives
|
||||||
|
|
||||||
|
Archives live here
|
|
@ -8,5 +8,8 @@
|
||||||
"github": "https://github.com",
|
"github": "https://github.com",
|
||||||
"email": "email:cirno@gensokyo.jp",
|
"email": "email:cirno@gensokyo.jp",
|
||||||
"orcid": "https://orcid.org/cirno"
|
"orcid": "https://orcid.org/cirno"
|
||||||
}
|
},
|
||||||
|
"extra": [
|
||||||
|
{ "route": "/archives", "name": "Archives" }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
import siteMetadata from '$content/metadata.json';
|
||||||
|
|
||||||
export const routes: { route: string, name: string, disabled?: boolean }[] = [
|
export const routes: { route: string, name: string, disabled?: boolean }[] = [
|
||||||
{ route: "/", name: "Home" },
|
{ route: "/", name: "Home" },
|
||||||
{ route: "/post", name: "Blog" },
|
{ route: "/post", name: "Blog" },
|
||||||
{ route: "/tag", name: "Tags" },
|
{ route: "/tag", name: "Tags" },
|
||||||
{ route: "/gallery", name: "Gallery", disabled: true },
|
{ route: "/gallery", name: "Gallery", disabled: true },
|
||||||
{ route: "/archives", name: "Archives" },
|
].concat(siteMetadata?.extra || []);
|
||||||
];
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
const { Content } = data;
|
const { slug, metadata, Content } = data;
|
||||||
import siteMetadata from '$content/metadata.json';
|
import siteMetadata from '$content/metadata.json';
|
||||||
|
|
||||||
|
const title = metadata?.title || (slug[0].toUpperCase() + slug.slice(1));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>Archives | {siteMetadata.blogName}</title>
|
<title>{title} | {siteMetadata.blogName}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
|
@ -0,0 +1,12 @@
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
import type { PageLoad } from './$types';
|
|
||||||
|
|
||||||
export const load: PageLoad = async (_) => {
|
|
||||||
const post = await import("$content/archives.md");
|
|
||||||
const Content = post.default;
|
|
||||||
|
|
||||||
return {
|
|
||||||
metadata: post.metadata,
|
|
||||||
Content,
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in New Issue