diff --git a/client/src/components/PoleElementsList.astro b/client/src/components/PoleElementsList.astro
new file mode 100644
index 00000000..12b923b6
--- /dev/null
+++ b/client/src/components/PoleElementsList.astro
@@ -0,0 +1,38 @@
+---
+// Import necessary components and utilities
+import MarkdownComponent from "./MardownContent.astro";
+import { getStrapiMedia } from "../utils/strapi";
+import { getStrapiBaseUrl } from "../config/strapi";
+import type { HTMLAttributes } from "astro/types";
+
+// Define the props interface
+export interface Props extends HTMLAttributes<'div'> {
+ elements: any[];
+}
+
+// Destructure props and get BASE_URL from global config
+const { elements, ...otherProps } = Astro.props;
+const BASE_URL = getStrapiBaseUrl();
+---
+
+
+ {
+ elements.map((poleElement) => (
+
+
+
+
+ {poleElement.data.name}
+
+
+
+ ))
+ }
+
\ No newline at end of file
diff --git a/client/src/config/strapi.ts b/client/src/config/strapi.ts
new file mode 100644
index 00000000..84880375
--- /dev/null
+++ b/client/src/config/strapi.ts
@@ -0,0 +1,9 @@
+// Global Strapi configuration
+export const STRAPI_CONFIG = {
+ BASE_URL: (import.meta.env.STRAPI_URL as string) || "http://localhost:1337",
+} as const;
+
+// Helper function to get the base URL
+export function getStrapiBaseUrl(): string {
+ return STRAPI_CONFIG.BASE_URL;
+}
\ No newline at end of file
diff --git a/client/src/pages/index.astro b/client/src/pages/index.astro
index 1680c9c0..55d40d73 100644
--- a/client/src/pages/index.astro
+++ b/client/src/pages/index.astro
@@ -2,13 +2,13 @@
// Import necessary components and utilities
import Layout from "../layouts/Layout.astro";
import { getCollection } from "astro:content";
-import MarkdownComponent from "../components/MardownContent.astro";
-import { getStrapiMedia } from "../utils/strapi";
+import PoleElementsList from "../components/PoleElementsList.astro";
+import { getStrapiBaseUrl } from "../config/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";
+// Get Strapi URL from global config
+const BASE_URL = getStrapiBaseUrl();
---
@@ -17,40 +17,12 @@ 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 */}
-
- {/* Post content container */}
-
-
- {poleElement.data.name}
-
-
-
- Published:{" "}
- {new Date(
- poleElement.data.publishedAt,
- ).toLocaleDateString()}
-
-
-
- ))
- }
-
+
+