Skip to content

Commit 517d09a

Browse files
KianNHkodster28
andauthored
[Docs Site] Add Stream content collection (#22938)
* [Docs Site] Add Stream content collection * folders * added field to schema and example * transcript field --------- Co-authored-by: kodster28 <[email protected]>
1 parent df7838a commit 517d09a

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

src/content.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
releaseNotesSchema,
2222
fieldsSchema,
2323
partialsSchema,
24+
streamSchema,
2425
} from "~/schemas";
2526

2627
function contentLoader(name: string) {
@@ -111,4 +112,8 @@ export const collections = {
111112
loader: dataLoader("fields"),
112113
schema: fieldsSchema,
113114
}),
115+
stream: defineCollection({
116+
loader: dataLoader("stream"),
117+
schema: streamSchema,
118+
}),
114119
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
id: streamid
2+
url: example-video
3+
title: Example Video
4+
description: A Super cool video
5+
products:
6+
- workers
7+
- workers-ai
8+
transcript: ./transcript.vtt
9+
chapters:
10+
00:01: Chapter 1
11+
00:02: Chapter 2
12+
thumbnail:
13+
url: https://example.com/foo.png
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
WEBVTT
2+
3+
00:11.000 --> 00:13.000
4+
<v Roger Bingham>We are in New York City
5+
6+
00:13.000 --> 00:16.000
7+
<v Roger Bingham>We're actually at the Lucern Hotel, just down the street
8+
9+
00:16.000 --> 00:18.000
10+
<v Roger Bingham>from the American Museum of Natural History
11+
12+
00:18.000 --> 00:20.000
13+
<v Roger Bingham>And with me is Neil deGrasse Tyson
14+
15+
00:20.000 --> 00:22.000
16+
<v Roger Bingham>Astrophysicist, Director of the Hayden Planetarium
17+
18+
00:22.000 --> 00:24.000
19+
<v Roger Bingham>at the AMNH.
20+
21+
00:24.000 --> 00:26.000
22+
<v Roger Bingham>Thank you for walking down here.
23+
24+
00:27.000 --> 00:30.000
25+
<v Roger Bingham>And I want to do a follow-up on the last conversation we did.
26+
27+
00:30.000 --> 00:31.500 align:right size:50%
28+
<v Roger Bingham>When we e-mailed—
29+
30+
00:30.500 --> 00:32.500 align:left size:50%
31+
<v Neil deGrasse Tyson>Didn't we talk about enough in that conversation?
32+
33+
00:32.000 --> 00:35.500 align:right size:50%
34+
<v Roger Bingham>No! No no no no; 'cos 'cos obviously 'cos
35+
36+
00:32.500 --> 00:33.500 align:left size:50%
37+
<v Neil deGrasse Tyson><i>Laughs</i>
38+
39+
00:35.500 --> 00:38.000
40+
<v Roger Bingham>You know I'm so excited my glasses are falling off here.

src/schemas/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export * from "./notifications";
1010
export * from "./pages-build-environment";
1111
export * from "./pages-framework-presets";
1212
export * from "./partials";
13+
export * from "./stream";
1314
export * from "./videos";
1415
export * from "./warp-releases";
1516
export * from "./workers-ai-models";

src/schemas/stream.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { z } from "astro:schema";
2+
import { reference } from "astro:content";
3+
4+
export const streamSchema = z.object({
5+
id: z.string(),
6+
url: z.string(),
7+
title: z.string(),
8+
description: z.string(),
9+
products: z.array(reference("products")),
10+
transcript: z.string().optional(),
11+
chapters: z.record(z.string(), z.string()).optional(),
12+
tags: z.array(z.string()).optional(),
13+
thumbnail: z
14+
.object({
15+
url: z.string(),
16+
})
17+
.or(
18+
z.object({
19+
timestamp: z.string(),
20+
}),
21+
)
22+
.optional(),
23+
});

0 commit comments

Comments
 (0)