From 6ab2246a8549e4d7ccf345fd4201a7028dd19799 Mon Sep 17 00:00:00 2001 From: Heather Yu <35639529+hetd54@users.noreply.github.com> Date: Mon, 15 Jul 2024 14:30:04 -0400 Subject: [PATCH] feat: custom map on map page --- public/admin/config.yml | 11 +++++++++++ src/content/config.ts | 16 +++++++++++++++- src/content/map/174.md | 4 ++++ src/pages/map.astro | 7 ++++++- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/content/map/174.md diff --git a/public/admin/config.yml b/public/admin/config.yml index 76d1e45..5e95aa1 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -13,6 +13,17 @@ i18n: # The locale to be used for fields validation and as a baseline for the entry. default_locale: en collections: + - name: map + label: Map + folder: src/content/map + create: false + fields: + - name: title + label: Map Version + widget: text + - name: image + label: MMP Community Map + widget: image - name: people label: People folder: src/content/people diff --git a/src/content/config.ts b/src/content/config.ts index b7c288b..1e8daa5 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -51,4 +51,18 @@ const people = defineCollection({ bio: z.string(), }), }) -export const collections = { news: news, data: files, people: people, publications: publications } + +const map = defineCollection({ + type: "content", + schema: z.object({ + title: z.string(), + image: z.string(), + }), +}) +export const collections = { + news: news, + data: files, + people: people, + publications: publications, + map: map, +} diff --git a/src/content/map/174.md b/src/content/map/174.md new file mode 100644 index 0000000..a83d6c3 --- /dev/null +++ b/src/content/map/174.md @@ -0,0 +1,4 @@ +--- +title: "174" +image: /public/images/MMP_Map.jpg +--- diff --git a/src/pages/map.astro b/src/pages/map.astro index e277b1d..20c9370 100644 --- a/src/pages/map.astro +++ b/src/pages/map.astro @@ -1,12 +1,17 @@ --- import { ReaderIcon } from "@radix-ui/react-icons" import Layout from "../layouts/Layout.astro" +import { getCollection } from "astro:content" + +const data = await getCollection("map") + +const maps = data.map((d) => d.data) ---
- + {maps.map((map) => )}