diff --git a/src/content.config.ts b/src/content.config.ts index 7152ad8da779ae3..10358cdb59e6d4b 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -21,6 +21,7 @@ import { releaseNotesSchema, fieldsSchema, partialsSchema, + streamSchema, } from "~/schemas"; function contentLoader(name: string) { @@ -111,4 +112,8 @@ export const collections = { loader: dataLoader("fields"), schema: fieldsSchema, }), + stream: defineCollection({ + loader: dataLoader("stream"), + schema: streamSchema, + }), }; diff --git a/src/content/stream/example-video/index.yaml b/src/content/stream/example-video/index.yaml new file mode 100644 index 000000000000000..0175d8c076c2473 --- /dev/null +++ b/src/content/stream/example-video/index.yaml @@ -0,0 +1,13 @@ +id: streamid +url: example-video +title: Example Video +description: A Super cool video +products: + - workers + - workers-ai +transcript: ./transcript.vtt +chapters: + 00:01: Chapter 1 + 00:02: Chapter 2 +thumbnail: + url: https://example.com/foo.png diff --git a/src/content/stream/example-video/transcript.vtt b/src/content/stream/example-video/transcript.vtt new file mode 100644 index 000000000000000..05a56bd38af02e5 --- /dev/null +++ b/src/content/stream/example-video/transcript.vtt @@ -0,0 +1,40 @@ +WEBVTT + +00:11.000 --> 00:13.000 +We are in New York City + +00:13.000 --> 00:16.000 +We're actually at the Lucern Hotel, just down the street + +00:16.000 --> 00:18.000 +from the American Museum of Natural History + +00:18.000 --> 00:20.000 +And with me is Neil deGrasse Tyson + +00:20.000 --> 00:22.000 +Astrophysicist, Director of the Hayden Planetarium + +00:22.000 --> 00:24.000 +at the AMNH. + +00:24.000 --> 00:26.000 +Thank you for walking down here. + +00:27.000 --> 00:30.000 +And I want to do a follow-up on the last conversation we did. + +00:30.000 --> 00:31.500 align:right size:50% +When we e-mailed— + +00:30.500 --> 00:32.500 align:left size:50% +Didn't we talk about enough in that conversation? + +00:32.000 --> 00:35.500 align:right size:50% +No! No no no no; 'cos 'cos obviously 'cos + +00:32.500 --> 00:33.500 align:left size:50% +Laughs + +00:35.500 --> 00:38.000 +You know I'm so excited my glasses are falling off here. \ No newline at end of file diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 96693979e79f407..03e3a86e7b80bbb 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -10,6 +10,7 @@ export * from "./notifications"; export * from "./pages-build-environment"; export * from "./pages-framework-presets"; export * from "./partials"; +export * from "./stream"; export * from "./videos"; export * from "./warp-releases"; export * from "./workers-ai-models"; diff --git a/src/schemas/stream.ts b/src/schemas/stream.ts new file mode 100644 index 000000000000000..9e074217712f496 --- /dev/null +++ b/src/schemas/stream.ts @@ -0,0 +1,23 @@ +import { z } from "astro:schema"; +import { reference } from "astro:content"; + +export const streamSchema = z.object({ + id: z.string(), + url: z.string(), + title: z.string(), + description: z.string(), + products: z.array(reference("products")), + transcript: z.string().optional(), + chapters: z.record(z.string(), z.string()).optional(), + tags: z.array(z.string()).optional(), + thumbnail: z + .object({ + url: z.string(), + }) + .or( + z.object({ + timestamp: z.string(), + }), + ) + .optional(), +});