diff --git a/client/src/pages/index.astro b/client/src/pages/index.astro index 71e51138..1680c9c0 100644 --- a/client/src/pages/index.astro +++ b/client/src/pages/index.astro @@ -1,41 +1,56 @@ --- // Import necessary components and utilities -import Layout from '../layouts/Layout.astro'; -import { getCollection } from 'astro:content'; +import Layout from "../layouts/Layout.astro"; +import { getCollection } from "astro:content"; import MarkdownComponent from "../components/MardownContent.astro"; -import { getStrapiMedia } from '../utils/strapi'; +import { getStrapiMedia } from "../utils/strapi"; // Fetch all posts from Strapi using Astro's content collection const strapiPoleElements = await getCollection("strapiPoleElementsLoader"); // Get Strapi URL from environment variables with fallback to localhost -const BASE_URL = await import.meta.env.STRAPI_URL || "http://localhost:1337"; +const BASE_URL = (await import.meta.env.STRAPI_URL) || "http://localhost:1337"; --- -
- -

Hello Strapi 5 and Astro 5 World

- -
- {/* Map through posts and create article cards */} - {strapiPoleElements.map((poleElement) => ( -
- {/* Post cover image */} - {poleElement.data.mainImage.alternativeText} - {/* Post content container */} -
-

{poleElement.data.name}

- -
- Published: {new Date(poleElement.data.publishedAt).toLocaleDateString()} -
-
-
- ))} +
+ +

+ Hello Strapi 5 and Astro 5 World +

+ +
+ {/* Map through posts and create article cards */} + { + strapiPoleElements.map((poleElement) => ( +
+ {/* Post cover image */} + {poleElement.data.mainImage.alternativeText} + {/* Post content container */} +
+

+ {poleElement.data.name} +

+ +
+ Published:{" "} + {new Date( + poleElement.data.publishedAt, + ).toLocaleDateString()} +
+
+
+ )) + } +
-
- \ No newline at end of file +