From 1bd58dc9d45cdd0e2d8967191a68a8ea3cf5a23c Mon Sep 17 00:00:00 2001 From: Robert McGovern Date: Tue, 5 Nov 2024 22:29:43 +0000 Subject: [PATCH] temp re-added collection and remove to imports of GetStaticPaths. Testing using cloudflare pages build --- .astro/content.d.ts | 10 +++++++++- src/content/config.ts | 3 +-- src/pages/blog/index.astro | 1 - src/pages/countries/[id].astro | 5 ----- src/pages/countries/index.astro | 1 - 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.astro/content.d.ts b/.astro/content.d.ts index 8670f36..c060203 100644 --- a/.astro/content.d.ts +++ b/.astro/content.d.ts @@ -192,7 +192,15 @@ declare module 'astro:content' { }; type DataEntryMap = { - + "countries": Record; + rendered?: RenderedContent; + filePath?: string; +}>; + }; type AnyEntryMap = ContentEntryMap & DataEntryMap; diff --git a/src/content/config.ts b/src/content/config.ts index 8fb6869..fc9c954 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -18,7 +18,6 @@ const countries = defineCollection({ loader: async () => { const response = await fetch('https://restcountries.com/v3.1/all') const data = await response.json() - console.log('🚀 ~ loader: ~ data:', data) // Must return an array of entries with an id property, or an object with IDs as keys and entries as values return data.map((country: any) => ({ @@ -125,4 +124,4 @@ const countries = defineCollection({ }) // export const collections = { countries, blog } -export const collections = { blog } +export const collections = { blog, countries } diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index b2b0a5b..8003a43 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -9,7 +9,6 @@ import FormattedDate from '../../components/FormattedDate.astro' const posts = (await getCollection('blog')).sort( (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf() ) -console.log('🚀 ~ posts', posts) --- diff --git a/src/pages/countries/[id].astro b/src/pages/countries/[id].astro index 3b97fd7..b16ab35 100644 --- a/src/pages/countries/[id].astro +++ b/src/pages/countries/[id].astro @@ -1,14 +1,9 @@ --- // src/pages/countries/[id].astro -import type { GetStaticPaths } from 'astro' import { getCollection } from 'astro:content' export async function getStaticPaths() { const collection = await getCollection('countries') - console.log( - '🚀 ~ constgetStaticPaths:GetStaticPaths= ~ collection:', - collection - ) if (!collection) return [] return collection.map((country) => ({ params: { diff --git a/src/pages/countries/index.astro b/src/pages/countries/index.astro index 80ae851..33d367f 100644 --- a/src/pages/countries/index.astro +++ b/src/pages/countries/index.astro @@ -8,7 +8,6 @@ import type { GetStaticPaths } from 'astro' import { getCollection } from 'astro:content' const countries = await getCollection('countries') -console.log('🚀 ~ countries:', countries) ---