+
+
+
+
diff --git a/packages/astro/src/content/blog/2020-02-06-code-for-san-francisco-2019-year-in-review.md b/packages/astro/src/content/blog/2020-02-06-code-for-san-francisco-2019-year-in-review.md
index e4be984..9c33824 100644
--- a/packages/astro/src/content/blog/2020-02-06-code-for-san-francisco-2019-year-in-review.md
+++ b/packages/astro/src/content/blog/2020-02-06-code-for-san-francisco-2019-year-in-review.md
@@ -1,5 +1,5 @@
---
-image: NDoCH-2019-2.jpg
+image: NDoCH-2019.jpg
image_alt: 'Emily Wasserman, team captain leads of National Day of Civic Hacking at GitHub'
title: Code for San Francisco 2019 Year in Review
description: 2019 was a very busy year for the Code for SF community!
diff --git a/packages/astro/src/layouts/Layout.astro b/packages/astro/src/layouts/Layout.astro
deleted file mode 100644
index bd79689..0000000
--- a/packages/astro/src/layouts/Layout.astro
+++ /dev/null
@@ -1,59 +0,0 @@
----
-interface Props {
- title: string;
-}
-
-const { title } = Astro.props;
----
-
-
-
-
-
-
-
-
-
-
- {title}
-
-
-
-
-
-
-
diff --git a/packages/astro/src/pages/blog/[slug].astro b/packages/astro/src/pages/blog/[slug].astro
index 935f946..6742b03 100644
--- a/packages/astro/src/pages/blog/[slug].astro
+++ b/packages/astro/src/pages/blog/[slug].astro
@@ -1,8 +1,8 @@
---
-import type { ImageMetadata } from "astro";
import { Image } from "astro:assets";
import { getCollection } from "astro:content";
import BaseLayout from "@/layouts/BaseLayout.astro";
+import { getBlogImage } from "@/utils/getBlogImage";
export async function getStaticPaths()
{
@@ -20,26 +20,14 @@ export async function getStaticPaths()
const { entry: { render, data: { title, image, image_alt = "" } } } = Astro.props;
const { Content } = await render();
-let imageSrc;
-
-if (image) {
- // this Vite import method requires that its parameter be a literal string, not even one assembled from other literals
- const images = import.meta.glob<{ default: ImageMetadata }>("/src/assets/blog/*.{jpeg,jpg,png,gif}");
- const imagePath = "/src/assets/blog/" + image.replace(/^\/img\/uploads\//, "");
-
- if (images[imagePath]) {
- imageSrc = images[imagePath]();
- } else {
- console.error(`${title} missing image: ${imagePath}`);
- }
-}
+const imageData = await getBlogImage(image);
---
{
- imageSrc &&
+ imageData &&
-
+
}
diff --git a/packages/astro/src/pages/index.astro b/packages/astro/src/pages/index.astro
index 2aaf943..ade24ff 100644
--- a/packages/astro/src/pages/index.astro
+++ b/packages/astro/src/pages/index.astro
@@ -1,6 +1,7 @@
---
import BaseLayout from "@/layouts/BaseLayout.astro";
import Card from "@/components/Card.astro";
+import NewsSummary from "@/components/NewsSummary.astro";
---
@@ -33,4 +34,5 @@ import Card from "@/components/Card.astro";
href="https://eepurl.com/bfFkF9"
/>
+
diff --git a/packages/astro/src/utils/getBlogImage.ts b/packages/astro/src/utils/getBlogImage.ts
new file mode 100644
index 0000000..84c6959
--- /dev/null
+++ b/packages/astro/src/utils/getBlogImage.ts
@@ -0,0 +1,22 @@
+import type { ImageMetadata } from "astro";
+
+const images = import.meta.glob<{ default: ImageMetadata }>("/src/assets/blog/*.{jpeg,jpg,png,gif}");
+
+export async function getBlogImage(
+ filename: string): Promise
+{
+ if (filename) {
+ // this Vite import method requires that its parameter be a literal string,
+ // not even one assembled from other literals
+ const imagePath = "/src/assets/blog/" + filename.replace(/^\/img\/uploads\//, "");
+
+ if (images[imagePath]) {
+ return (await images[imagePath]()).default;
+// return await images[imagePath]();
+ }
+
+ console.error(`Missing image: ${imagePath}`);
+ }
+
+ return null;
+}