aboutsummaryrefslogtreecommitdiff
path: root/website/src/content.config.ts
blob: 6282421be937e7bae4ddd1ab21ee549e3cedac48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { defineCollection } from 'astro:content';
import { docsLoader } from '@astrojs/starlight/loaders';
import { docsSchema } from '@astrojs/starlight/schema';

function docsPath({ entry }: { entry: string }) {
  const slug = entry.replace(/\.(md|mdx|markdown|mdown|mkdn|mkd|mdwn)$/i, '');
  return slug === 'index' ? 'docs' : `docs/${slug}`;
}

export const collections = {
  docs: defineCollection({ loader: docsLoader({ generateId: docsPath }), schema: docsSchema() }),
};