diff --git a/website/src/components/ListingPage.astro b/website/src/components/ListingPage.astro new file mode 100644 index 00000000..16e66f4e --- /dev/null +++ b/website/src/components/ListingPage.astro @@ -0,0 +1,24 @@ +--- +import PageLayout from "~/layouts/PageLayout.astro"; +import ListingPageItem from "./ListingPageItem.astro"; + +interface Item { + description: string; + title: string; +} + +interface Props { + items: Array; + title: string; +} + +const { items, title } = Astro.props as Props; +--- + + + + +
+ {items.map((item) => )} +
+
diff --git a/website/src/components/ListingPageItem.astro b/website/src/components/ListingPageItem.astro new file mode 100644 index 00000000..3f67ea9a --- /dev/null +++ b/website/src/components/ListingPageItem.astro @@ -0,0 +1,31 @@ +--- +interface ItemProps { + date: string; + description?: string; + excerpt?: string; + title: string; +} + +const { date, description, excerpt, title } = Astro.props.item.item + .frontmatter as ItemProps; +const { slug } = Astro.props.item; +--- + +
+

{title}

+ + { + date && ( + + ) + } + + {description &&

{description}

} + {excerpt &&

{excerpt}

} +
diff --git a/website/src/pages/blog/index.astro b/website/src/pages/blog/index.astro index bace659e..8940fdf9 100644 --- a/website/src/pages/blog/index.astro +++ b/website/src/pages/blog/index.astro @@ -1,4 +1,5 @@ --- +import ListingPage from "~/components/ListingPage.astro"; import PageLayout from "~/layouts/PageLayout.astro"; import { getSlugFromFile } from "~/utils.ts"; @@ -11,50 +12,21 @@ const filteredPosts = posts const sortedPosts = filteredPosts .map((post) => { - const slug = getSlugFromFile(post.file); + const slug = `/blog/${getSlugFromFile(post.file)}`; - return { post, slug }; + return { item: post, slug }; }) .sort( (a, b) => - new Date(b.post.frontmatter.date).valueOf() - - new Date(a.post.frontmatter.date).valueOf() + new Date(b.item.frontmatter.date).valueOf() - + new Date(a.item.frontmatter.date).valueOf() ); --- - -

+ +

This is where I publish my personal blog posts as well as technical posts and tutorials on topics such as Drupal, PHP, Tailwind CSS, automated testing, and systems administration.

- -
- { - sortedPosts.map((post) => ( -
- -

{post.post.frontmatter.title}

-
- - {post.post.frontmatter.date && ( - - )} - -
-

{post.post.frontmatter.excerpt}

-
-
- )) - } -
-
+ diff --git a/website/src/pages/talks/index.astro b/website/src/pages/talks/index.astro index d2fea0f3..157ddcc2 100644 --- a/website/src/pages/talks/index.astro +++ b/website/src/pages/talks/index.astro @@ -2,6 +2,7 @@ import PageLayout from "~/layouts/PageLayout.astro"; import _ from "lodash"; import { getSlugFromFile } from "~/utils.ts"; +import ListingPage from "~/components/ListingPage.astro"; const talks = await Astro.glob("../../talks/*.md"); @@ -11,14 +12,14 @@ const talkCount = _(talks) const sortedTalks = talks .map((talk) => { - const slug = getSlugFromFile(talk.file); + const slug = `/talks/${getSlugFromFile(talk.file)}`; - return { slug, talk }; + return { slug, item: talk }; }) .sort((b, a) => { const events = [ - a.talk.frontmatter.events[a.talk.frontmatter.events.length - 1], - b.talk.frontmatter.events[b.talk.frontmatter.events.length - 1], + a.item.frontmatter.events[a.item.frontmatter.events.length - 1], + b.item.frontmatter.events[b.item.frontmatter.events.length - 1], ]; return ( @@ -27,24 +28,10 @@ const sortedTalks = talks }); --- - -

+ +

Starting with my first talk in September 2012, I have given {talkCount} presentations and workshops at various conferences and meetups, in-person and remotely, on topics including PHP, Drupal, automated testing, Git, CSS, and systems administration.

- -
- { - sortedTalks.map((talk) => ( - - )) - } -
-
+