mirror of
https://github.com/maciejpedzich/cats-album.git
synced 2024-11-09 23:03:02 +01:00
Create a cats document schema
This commit is contained in:
parent
8b2a7f0e4d
commit
8592ebc8f2
BIN
public/images/maciejpedzich-placeholder.jpg
Normal file
BIN
public/images/maciejpedzich-placeholder.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
12
src/content/cats/maciejpedzich-placeholder.json
Normal file
12
src/content/cats/maciejpedzich-placeholder.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "Placeholder",
|
||||||
|
"description": "This is a placeholder cat with a photo taken from placekitten.com",
|
||||||
|
"image": {
|
||||||
|
"src": "/images/maciejpedzich-placeholder.jpg",
|
||||||
|
"alt": "Sample alt text"
|
||||||
|
},
|
||||||
|
"owner": {
|
||||||
|
"name": "Maciej Pędzich",
|
||||||
|
"link": "https://maciejpedzi.ch"
|
||||||
|
}
|
||||||
|
}
|
20
src/content/config.ts
Normal file
20
src/content/config.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { z, defineCollection } from 'astro:content';
|
||||||
|
|
||||||
|
const cats = defineCollection({
|
||||||
|
type: 'data',
|
||||||
|
schema: z.object({
|
||||||
|
name: z.string(),
|
||||||
|
description: z.string().max(250),
|
||||||
|
image: z.object({
|
||||||
|
src: z.string(),
|
||||||
|
alt: z.string()
|
||||||
|
}),
|
||||||
|
passedAway: z.boolean().optional().default(false),
|
||||||
|
owner: z.object({
|
||||||
|
name: z.string(),
|
||||||
|
link: z.string().optional()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
export const collections = { cats };
|
1
src/env.d.ts
vendored
1
src/env.d.ts
vendored
@ -1 +1,2 @@
|
|||||||
|
/// <reference path="../.astro/types.d.ts" />
|
||||||
/// <reference types="astro/client" />
|
/// <reference types="astro/client" />
|
||||||
|
Loading…
Reference in New Issue
Block a user