diff --git a/src/lib/server/markdown.ts b/src/lib/server/markdown.ts index 72093e0e1..6285e7a24 100644 --- a/src/lib/server/markdown.ts +++ b/src/lib/server/markdown.ts @@ -142,14 +142,6 @@ function render_content>( return { meta_data: data as T, html: html_with_svg } } -/** - * Names of stored markdown files - */ -export const content_ids = fs - .readdirSync(path.resolve('content')) - .filter((file) => file.endsWith('.md')) - .map((file) => file.replace(/\.md$/, '')) - type ContentMetaData = { title: string description: string @@ -168,3 +160,19 @@ export function get_rendered_content(id: string) { return render_content(txt) } + +/** + * Returns the list of metadata of content pages + */ +export function get_content_pages() { + return fs + .readdirSync(path.resolve('content')) + .filter((file) => file.endsWith('.md')) + .map((file) => { + const id = path.basename(file, '.md') + const txt = fs.readFileSync(path.resolve('content', file), 'utf8') + const data = matter(txt).data as ContentMetaData + return { ...data, id } + }) + .sort((p, q) => p.title.localeCompare(q.title, 'en', { sensitivity: 'base' })) +} diff --git a/src/routes/category-implications/+page.svelte b/src/routes/category-implications/+page.svelte index 3d4806ee4..e0e57b85a 100644 --- a/src/routes/category-implications/+page.svelte +++ b/src/routes/category-implications/+page.svelte @@ -27,5 +27,10 @@ category is self-dual and, for example, complete, it is automatically inferred to be cocomplete as well.

+ +

+ For results that do not quite fit the implication model, + content pages are used instead. +

{/snippet} diff --git a/src/routes/content/+page.server.ts b/src/routes/content/+page.server.ts new file mode 100644 index 000000000..70a1a25af --- /dev/null +++ b/src/routes/content/+page.server.ts @@ -0,0 +1,5 @@ +import { get_content_pages } from '$lib/server/markdown' + +export const load = () => { + return { pages: get_content_pages() } +} diff --git a/src/routes/content/+page.svelte b/src/routes/content/+page.svelte new file mode 100644 index 000000000..739d3c330 --- /dev/null +++ b/src/routes/content/+page.svelte @@ -0,0 +1,25 @@ + + + + +

Content pages

+ +

+ For long-form content, particularly longer proofs and reusable lemmas, we use content + pages. +

+ +
    + {#each data.pages as page} +
  • + {page.title} +
  • + {/each} +
diff --git a/src/routes/content/[id]/+page.server.ts b/src/routes/content/[id]/+page.server.ts index cf5d12d3f..27d3ab111 100644 --- a/src/routes/content/[id]/+page.server.ts +++ b/src/routes/content/[id]/+page.server.ts @@ -1,14 +1,9 @@ -import { content_ids, get_rendered_content } from '$lib/server/markdown' +import { get_rendered_content } from '$lib/server/markdown' import { error } from '@sveltejs/kit' -import type { EntryGenerator } from './$types' import { batch } from '$lib/server/db.catdat' import sql from 'sql-template-tag' import type { StructureShort, PropertyShort } from '$lib/commons/types' -export const entries: EntryGenerator = () => { - return content_ids.map((id) => ({ id })) -} - export const load = async (event) => { const id = event.params.id const content = get_rendered_content(id) diff --git a/src/routes/functor-implications/+page.svelte b/src/routes/functor-implications/+page.svelte index 3f390b6ee..beb32efa4 100644 --- a/src/routes/functor-implications/+page.svelte +++ b/src/routes/functor-implications/+page.svelte @@ -17,5 +17,10 @@ properties exist. For example, the statement that a right adjoint is continuous automatically implies that a left adjoint is cocontinuous.

+ +

+ For results that do not quite fit the implication model, + content pages are used instead. +

{/snippet}