-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
2,719 additions
and
2,032 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { languages } from '@layouts/languages' | ||
import { defineCollection, z } from 'astro:content' | ||
import { contentBase } from './campaignsKeystatic' | ||
import { extractedProjectKeys } from './extractedProjectKeys' | ||
import { loader } from './utils/loader' | ||
|
||
export const AstroCampaignSchema = z.object({ | ||
name: z.string(), | ||
menuTitle: z.string(), | ||
project: z.enum(extractedProjectKeys), | ||
pubDate: z | ||
.string() | ||
.or(z.date()) | ||
.transform((val) => new Date(val)), | ||
author: z.string(), | ||
inMenu: z.boolean(), | ||
language: z.enum(languages).optional(), | ||
maprouletteChallenge: z.object({ | ||
id: z.number().nullable(), | ||
enabled: z.boolean(), | ||
name: z.string(), | ||
remoteGeoJson: z.string().url(), | ||
checkinComment: z.string(), | ||
checkinSource: z.string(), | ||
}), | ||
}) | ||
|
||
export type AstroCampaignType = z.infer<typeof AstroCampaignSchema> & { content: string } | ||
|
||
export const astroCampaignsDefinition = defineCollection({ | ||
loader: loader(contentBase, 'json'), | ||
schema: () => AstroCampaignSchema, | ||
}) |
34 changes: 2 additions & 32 deletions
34
keystatic/keystatic.campaigns.config.tsx → keystatic/campaignsKeystatic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { languages } from '@layouts/languages' | ||
import { defineCollection, z } from 'astro:content' | ||
import { extractedProjectKeys } from './extractedProjectKeys' | ||
import { contentBase } from './postsKeystatic' | ||
import { loader } from './utils/loader' | ||
|
||
export const astroPostsDefinition = defineCollection({ | ||
loader: loader(contentBase, 'mdx'), | ||
schema: ({ image }) => | ||
z.object({ | ||
title: z.string(), | ||
menuTitle: z.string(), | ||
project: z.enum(extractedProjectKeys), | ||
pubDate: z | ||
.string() | ||
.or(z.date()) | ||
.transform((val) => new Date(val)), | ||
updatedDate: z | ||
.string() | ||
.or(z.date()) | ||
.transform((val) => new Date(val)) | ||
.optional(), // Note: implemented but unused ATM | ||
author: z.string(), | ||
inMenu: z.boolean(), | ||
noindex: z.boolean().optional(), | ||
language: z.enum(languages).optional(), | ||
image: image().nullish(), | ||
imageAlt: z.string().optional(), | ||
showToc: z.boolean().optional(), // TODO Do we need this? | ||
canonicalUrl: z.string().url().optional(), | ||
}), | ||
}) |
33 changes: 2 additions & 31 deletions
33
keystatic/keystatic.posts.config.tsx → keystatic/postsKeystatic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { languages } from '@layouts/languages' | ||
import { defineCollection, z, type CollectionEntry } from 'astro:content' | ||
import { contentBase } from './projectsKeystatic' | ||
import { loader } from './utils/loader' | ||
|
||
export type TProjectConfig = CollectionEntry<'projects'>['data']['projects'][number] | ||
|
||
export const astroProjectsDefinition = defineCollection({ | ||
loader: loader(contentBase, 'json'), | ||
schema: ({ image }) => | ||
z.object({ | ||
projects: z.array( | ||
z.object({ | ||
enabled: z.boolean(), | ||
name: z.object({ name: z.string(), slug: z.string() }), | ||
externalProjektPage: z.string().optional(), | ||
header: z.enum(['ProjectHeader', 'AboutHeader']), | ||
menus: z | ||
.array( | ||
// Menu Group | ||
z.object({ | ||
label: z.string().nullish(), | ||
// Menu Items | ||
items: z.array(z.object({ href: z.string(), label: z.string() })), | ||
}), | ||
) | ||
.nullish(), | ||
menuNews: z.boolean(), | ||
additionalFooterLinks: z | ||
.array(z.object({ href: z.string(), label: z.string() })) | ||
.optional(), | ||
meta: z.object({ | ||
title: z.string(), | ||
description: z.string().nullish(), | ||
image: image().nullish(), | ||
imageAlt: z.string().nullish(), | ||
language: z.enum(languages), | ||
}), | ||
}), | ||
), | ||
}), | ||
}) |
43 changes: 2 additions & 41 deletions
43
keystatic/keystatic.projects.config.tsx → keystatic/projectsKeystatic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { glob } from 'astro/loaders' | ||
|
||
export const loader = (contentBase: string, format: 'mdx' | 'json' | 'yaml') => { | ||
const base = contentBase.startsWith('/') ? `.${contentBase}` : contentBase | ||
return glob({ | ||
base: base, | ||
pattern: `**\/[^_]*.${format}`, | ||
}) | ||
} |
Oops, something went wrong.