add content collection schemas
This commit is contained in:
+22
-4
@@ -1,11 +1,29 @@
|
||||
// 1. Import utilities from `astro:content`
|
||||
import { defineCollection } from "astro:content";
|
||||
import { defineCollection, z } from "astro:content";
|
||||
// 2. Define your collection(s)
|
||||
const blogCollection = defineCollection({
|
||||
/* ... */
|
||||
const journalCollection = defineCollection({
|
||||
type: "content",
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
date: z.date(),
|
||||
tags: z.string().array(),
|
||||
category: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
}),
|
||||
});
|
||||
const articleCollection = defineCollection({
|
||||
type: "content",
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
date: z.date(),
|
||||
tags: z.string().array(),
|
||||
category: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
}),
|
||||
});
|
||||
// 3. Export a single `collections` object to register your collection(s)
|
||||
// This key should match your collection directory name in "src/content"
|
||||
export const collections = {
|
||||
blog: blogCollection,
|
||||
"journal-entries": journalCollection,
|
||||
articles: articleCollection,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
---
|
||||
title: MySQL JSON Shenanigans
|
||||
date: 2024-11-19
|
||||
tags: ["mysql"]
|
||||
category: "MySQL"
|
||||
description: "Out of the box, there is a MySQL text encoding mismatch between VARCHAR columns and JSON columns."
|
||||
---
|
||||
|
||||
In an effort to support out-of-date installations of our app, I had to keep a JSON column in our database. The column is obsolete, as are the values within it; but these installations continue to use it. So, knowing this, I decided to put the proper values into the column. I didn't want to pollute the code of our services to do so, though. So I made it into a `GENERATED` column.
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
---
|
||||
title: Elasticsearch Ingestion Daemon
|
||||
date: 2024-11-20
|
||||
tags: ["elasticsearch"]
|
||||
category: "Elasticsearch"
|
||||
description: "Batch-processing boundaries need to be defined with enough information to point to exactly one record, taking into account records being updated between batches."
|
||||
---
|
||||
|
||||
I still saw requests coming in through an old Cloudflare-Worker-based proxy I had set up, before I released the current one, which rewrites `m3u8` files on-the-fly, besides proxying the segment files themselves (among other features). I updated our website and app to use the new proxy; where were these requests coming from? I inspected some requests as they came in using the Cloudflare interface, and I found that the User Agent was always one of our apps; and different versions of it at that. We still had un-updated versions of our app out in the wild, but I also saw requests from the latest version! How could this be?
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
---
|
||||
title: React-Admin Wrestling, a Little More Elasticsearch
|
||||
date: 2024-11-21
|
||||
tags: ["react", "react-admin", "elasticsearch"]
|
||||
category: "React Admin"
|
||||
description: "(This article is still incomplete. I began writing this entry after work the day it happened, and I didn't get a chance to get back to it until today (12 days later), so I forgot what I was planning on writing about!)"
|
||||
---
|
||||
|
||||
React-admin is a wonderful framework, and is quite flexible; but if you need something that it doesn't offer, it's very difficult to dig through the docs to find out how to do it.
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
---
|
||||
title: "@astrojs/node Build Error"
|
||||
date: 2024-11-23
|
||||
tags: ["astro"]
|
||||
category: "Astro"
|
||||
description: "Always prefix native imports with `node:`, even in dependencies. If a dependency doesn't do it, adjust your build-step to do it for you."
|
||||
---
|
||||
|
||||
Today's entry is about this very site.
|
||||
@@ -62,4 +65,4 @@ export default defineConfig({
|
||||
});
|
||||
```
|
||||
|
||||
The worked famously.
|
||||
This worked famously.
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
---
|
||||
title: "Content Frontmatter Causes `astro build` Error?"
|
||||
date: 2024-11-24
|
||||
tags: ["astro"]
|
||||
category: "Astro"
|
||||
description: "Keep your eyes peeled for special characters."
|
||||
---
|
||||
|
||||
Another entry for this site. I ran `pnpm run build` after adding yesterday's entry, and got this error:
|
||||
@@ -48,3 +51,5 @@ date: 2024-11-23
|
||||
|
||||
<... rest of the file...>
|
||||
```
|
||||
|
||||
It seems that the `@` character signals an import from another file, and obviously there wasn't any so-named file.
|
||||
|
||||
Reference in New Issue
Block a user