Frontmatter in markdown
Use yaml format at the beginning of your md file.
---
title: Some title
description: some description
--- md
Frontmatter in svelte
Export a const variable name as frontmatter in Svelte script module would do
/src/routes/foo/+page.svelte
<script module>
export const
const frontmatter: {
title: string;
description: string;
}
frontmatter = {
title: stringtitle: 'Some title',
description: stringdescription: 'Some description',
}
</script> svelte
Accessing frontmatter in markdown
Use fm variable:
Frontmatter of this page is:
${$.escape(JSON.stringify(fm, null, 2))}
Frontmatter of this page is:
<pre>
{JSON.stringify(fm, null, 2)}
</pre> md
Site frontmatter
The global shared frontmatter for every +page.md file
interface SiteConfig {
SiteConfig.title?: string | undefinedtitle?: string
SiteConfig.description?: string | undefineddescription?: string
} ts