generated from polymech/site-template
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import { defineCollection, z } from "astro:content"
|
|
import { loader } from './model/component.js'
|
|
import { ComponentConfigSchema } from '@polymech/commons/component'
|
|
import { RETAIL_PRODUCT_BRANCH, PROJECTS_BRANCH } from 'config/config.js'
|
|
|
|
import { glob } from 'astro/loaders'
|
|
|
|
const store = defineCollection({
|
|
loader: loader(RETAIL_PRODUCT_BRANCH) as any,
|
|
schema: ComponentConfigSchema.passthrough(),
|
|
})
|
|
const projects = defineCollection({
|
|
loader: loader(PROJECTS_BRANCH) as any,
|
|
schema: ComponentConfigSchema.passthrough(),
|
|
})
|
|
const helpcenter = defineCollection({
|
|
schema: z.object({
|
|
title: z.string(),
|
|
intro: z.string(),
|
|
})
|
|
})
|
|
const infopages = defineCollection({
|
|
schema: z.object({
|
|
title: z.string().optional(),
|
|
intro: z.string().optional(),
|
|
}).passthrough(),
|
|
})
|
|
|
|
const resources = defineCollection({
|
|
loader: glob({ base: './src/content/resources', pattern: '*.{md,mdx}' }),
|
|
schema: z.object({
|
|
title: z.string().optional().default('Untitled'),
|
|
pubDate: z.date().optional().default(new Date()),
|
|
description: z.string().optional().default('No description provided'),
|
|
author: z.string().optional().default('Anonymous'),
|
|
image: z.object({
|
|
url: z.string().optional().default(''),
|
|
alt: z.string().optional().default('')
|
|
}).optional().default({ url: '', alt: '' }),
|
|
tags: z.array(z.string()).optional().default([])
|
|
}).passthrough(),
|
|
});
|
|
|
|
export const collections = {
|
|
store,
|
|
projects,
|
|
resources,
|
|
helpcenter,
|
|
infopages
|
|
}; |