refactor: use a content collection for talks
This commit is contained in:
parent
85644e4f2d
commit
7b97ad3af2
142
.astro/types.d.ts
vendored
142
.astro/types.d.ts
vendored
|
@ -111,251 +111,251 @@ declare module 'astro:content' {
|
|||
>;
|
||||
|
||||
const entryMap: {
|
||||
"talks": {
|
||||
"talk": {
|
||||
"about-drupal-association.md": {
|
||||
id: "about-drupal-association.md",
|
||||
slug: "about-drupal-association",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"automated-testing-test-driven-development-drupal-8.md": {
|
||||
id: "automated-testing-test-driven-development-drupal-8.md",
|
||||
slug: "automated-testing-test-driven-development-drupal-8",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"building-presenting-slide-decks-rst2pdf.md": {
|
||||
id: "building-presenting-slide-decks-rst2pdf.md",
|
||||
slug: "building-presenting-slide-decks-rst2pdf",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"building-static-websites-sculpin.md": {
|
||||
id: "building-static-websites-sculpin.md",
|
||||
slug: "building-static-websites-sculpin",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"configuring-all-the-things-drupal-8.md": {
|
||||
id: "configuring-all-the-things-drupal-8.md",
|
||||
slug: "configuring-all-the-things-drupal-8",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"dancing-for-drupal.md": {
|
||||
id: "dancing-for-drupal.md",
|
||||
slug: "dancing-for-drupal",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"decoupling-drupal-vuejs.md": {
|
||||
id: "decoupling-drupal-vuejs.md",
|
||||
slug: "decoupling-drupal-vuejs",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"deploying-drupal-fabric.md": {
|
||||
id: "deploying-drupal-fabric.md",
|
||||
slug: "deploying-drupal-fabric",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"deploying-php-ansible-ansistrano.md": {
|
||||
id: "deploying-php-ansible-ansistrano.md",
|
||||
slug: "deploying-php-ansible-ansistrano",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"deploying-php-fabric.md": {
|
||||
id: "deploying-php-fabric.md",
|
||||
slug: "deploying-php-fabric",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"drupal-8-module-development.md": {
|
||||
id: "drupal-8-module-development.md",
|
||||
slug: "drupal-8-module-development",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"drupal-8-php-libraries-drupalorg-api.md": {
|
||||
id: "drupal-8-php-libraries-drupalorg-api.md",
|
||||
slug: "drupal-8-php-libraries-drupalorg-api",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"drupal-8-rejoining-the-herd.md": {
|
||||
id: "drupal-8-rejoining-the-herd.md",
|
||||
slug: "drupal-8-rejoining-the-herd",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"drupal-8.md": {
|
||||
id: "drupal-8.md",
|
||||
slug: "drupal-8",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"drupal-ldap-module.md": {
|
||||
id: "drupal-ldap-module.md",
|
||||
slug: "drupal-ldap-module",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"drupal-vm-generator.md": {
|
||||
id: "drupal-vm-generator.md",
|
||||
slug: "drupal-vm-generator",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"drupal-vm-meet-symfony-console.md": {
|
||||
id: "drupal-vm-meet-symfony-console.md",
|
||||
slug: "drupal-vm-meet-symfony-console",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"drupalorg-2015.md": {
|
||||
id: "drupalorg-2015.md",
|
||||
slug: "drupalorg-2015",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"drush-make-drupalbristol.md": {
|
||||
id: "drush-make-drupalbristol.md",
|
||||
slug: "drush-make-drupalbristol",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"getting-your-data-into-drupal-8.md": {
|
||||
id: "getting-your-data-into-drupal-8.md",
|
||||
slug: "getting-your-data-into-drupal-8",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"git-flow.md": {
|
||||
id: "git-flow.md",
|
||||
slug: "git-flow",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"goodbye-drush-make-hello-composer.md": {
|
||||
id: "goodbye-drush-make-hello-composer.md",
|
||||
slug: "goodbye-drush-make-hello-composer",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"introduction-to-mob-programming.md": {
|
||||
id: "introduction-to-mob-programming.md",
|
||||
slug: "introduction-to-mob-programming",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"it-all-started-with-a-patch.md": {
|
||||
id: "it-all-started-with-a-patch.md",
|
||||
slug: "it-all-started-with-a-patch",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"modern-drupal-development-with-composer.md": {
|
||||
id: "modern-drupal-development-with-composer.md",
|
||||
slug: "modern-drupal-development-with-composer",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"out-of-the-box-initiative-update.md": {
|
||||
id: "out-of-the-box-initiative-update.md",
|
||||
slug: "out-of-the-box-initiative-update",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"so-what-is-this-drupal-thing.md": {
|
||||
id: "so-what-is-this-drupal-thing.md",
|
||||
slug: "so-what-is-this-drupal-thing",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"taking-flight-with-tailwind-css.md": {
|
||||
id: "taking-flight-with-tailwind-css.md",
|
||||
slug: "taking-flight-with-tailwind-css",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"tdd-test-driven-drupal.md": {
|
||||
id: "tdd-test-driven-drupal.md",
|
||||
slug: "tdd-test-driven-drupal",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"test-drive-twig-with-sculpin.md": {
|
||||
id: "test-drive-twig-with-sculpin.md",
|
||||
slug: "test-drive-twig-with-sculpin",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"things-you-should-know-about-php.md": {
|
||||
id: "things-you-should-know-about-php.md",
|
||||
slug: "things-you-should-know-about-php",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"upgrading-your-site-drupal-9.md": {
|
||||
id: "upgrading-your-site-drupal-9.md",
|
||||
slug: "upgrading-your-site-drupal-9",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"using-illuminate-collections-outside-laravel.md": {
|
||||
id: "using-illuminate-collections-outside-laravel.md",
|
||||
slug: "using-illuminate-collections-outside-laravel",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"working-with-workspace.md": {
|
||||
id: "working-with-workspace.md",
|
||||
slug: "working-with-workspace",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
"working-without-workspace.md": {
|
||||
id: "working-without-workspace.md",
|
||||
slug: "working-without-workspace",
|
||||
body: string,
|
||||
collection: "talks",
|
||||
data: any
|
||||
collection: "talk",
|
||||
data: InferEntrySchema<"talk">
|
||||
} & { render(): Render[".md"] },
|
||||
},
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ interface ItemProps {
|
|||
title: string;
|
||||
}
|
||||
|
||||
const { date, description, excerpt, title } = Astro.props.item.item
|
||||
.frontmatter as ItemProps;
|
||||
const { date, description, excerpt, title } = Astro.props.item.item.data as ItemProps;
|
||||
const { slug } = Astro.props.item;
|
||||
---
|
||||
|
||||
|
|
20
src/content/config.ts
Normal file
20
src/content/config.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { defineCollection, z } from 'astro:content';
|
||||
|
||||
const talkCollection = defineCollection({
|
||||
schema: z.object({
|
||||
description: z.string(),
|
||||
events: z.array(z.object({
|
||||
date: z.string(),
|
||||
location: z.string().optional(),
|
||||
name: z.string(),
|
||||
online: z.boolean().optional(),
|
||||
})),
|
||||
title: z.string(),
|
||||
// TODO: add SpeakerDeck
|
||||
// TODO: add Video
|
||||
}),
|
||||
});
|
||||
|
||||
export const collections = {
|
||||
'talk': talkCollection,
|
||||
};
|
|
@ -21,6 +21,7 @@ events:
|
|||
time: "15:00 - 15:40"
|
||||
|
||||
- name: Drupal Somerset
|
||||
location: Glastonbury, UK
|
||||
date: "2017-10-26"
|
||||
---
|
||||
|
|
@ -69,7 +69,6 @@ events:
|
|||
|
||||
- name: Midwest PHP
|
||||
date: "2021-04-23"
|
||||
location: ~
|
||||
url: https://midwestphp.org/talks/1q5XUF2tTdXXLYOoujMkpF/Deploying_PHP_applications_with_Ansible_Ansible_Vault_and_Ansistrano
|
||||
online: true
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
title: An introduction to mob programming
|
||||
description: ''
|
||||
speakerdeck:
|
||||
id: f37b16f915d64bc0b4a20f9f965e5353
|
||||
ratio: 1.77725118483412
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Working without Workspace
|
||||
description: ~
|
||||
description: ''
|
||||
speakerdeck:
|
||||
id: dd406a45f04047fda765346b75efa3c3
|
||||
ratio: "1.77798682972719"
|
||||
|
@ -12,4 +12,3 @@ events:
|
|||
url: https://www.meetup.com/phplondon/events/292657869
|
||||
date: "2023-04-06"
|
||||
---
|
||||
|
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" />
|
||||
|
|
|
@ -6,22 +6,21 @@ import Markdown from "~/components/Markdown.astro";
|
|||
import Slides from "~/components/talk/Slides.astro";
|
||||
import Video from "~/components/talk/Video.astro";
|
||||
import { getSlugFromFile } from "~/utils.ts";
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const talks = await Astro.glob("../../talks/*.md");
|
||||
const talks = await getCollection('talk')
|
||||
|
||||
return talks.map((talk) => {
|
||||
const slug = getSlugFromFile(talk.file);
|
||||
|
||||
return {
|
||||
params: { slug },
|
||||
params: { slug: talk.slug },
|
||||
props: { talk },
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const { Content } = Astro.props.talk;
|
||||
const { events, speakerdeck, title, video } = Astro.props.talk.frontmatter;
|
||||
const { Content } = await Astro.props.talk.render();
|
||||
const { events, speakerdeck, title, video } = Astro.props.talk.data;
|
||||
---
|
||||
|
||||
<Layout title={title}>
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
---
|
||||
import PageLayout from "~/layouts/PageLayout.astro";
|
||||
import _ from "lodash";
|
||||
import { getSlugFromFile } from "~/utils.ts";
|
||||
import ListingPage from "~/components/ListingPage.astro";
|
||||
import _ from "lodash";
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
const talks = await Astro.glob("../../talks/*.md");
|
||||
const talks = await getCollection('talk');
|
||||
|
||||
const talkCount = _(talks)
|
||||
.flatMap((talk) => talk.frontmatter.events)
|
||||
.flatMap((talk) => talk.data.events)
|
||||
.size();
|
||||
|
||||
const sortedTalks = talks
|
||||
.map((talk) => {
|
||||
const slug = `/talks/${getSlugFromFile(talk.file)}`;
|
||||
const slug = `/talks/${talk.slug}`
|
||||
|
||||
return { slug, item: talk };
|
||||
})
|
||||
.sort((b, a) => {
|
||||
const events = [
|
||||
a.item.frontmatter.events[a.item.frontmatter.events.length - 1],
|
||||
b.item.frontmatter.events[b.item.frontmatter.events.length - 1],
|
||||
a.item.data.events[a.item.data.events.length - 1],
|
||||
b.item.data.events[b.item.data.events.length - 1],
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~/*": ["src/*"],
|
||||
}
|
||||
"~/*": ["src/*"]
|
||||
},
|
||||
"strictNullChecks": true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue