{data.title}
-Publié le : {data.date}
Auteur : {data.author}
diff --git a/package.json b/package.json index 611c812..f1d4a96 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/adapter-static": "^2.0.3", + "@sveltejs/adapter-static": "^3.0.1", "@sveltejs/kit": "^1.20.4", "@tailwindcss/typography": "^0.5.9", "@types/node": "^20.8.10", @@ -29,6 +29,7 @@ }, "type": "module", "dependencies": { - "marked": "^9.1.5" + "marked": "^9.1.5", + "vite-plugin-markdown": "^2.1.0" } } diff --git a/src/app.postcss b/src/app.postcss index 5a4a9a6..52b1c64 100644 --- a/src/app.postcss +++ b/src/app.postcss @@ -9,13 +9,13 @@ @apply text-xl; } li { - @apply list-disc text-xl py-1; + @apply list-disc text-xl py-1 ml-8; } h1 { @apply text-3xl border-b-2 dark:border-b-white border-b-gray-400 py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-300 to-orange-200; } h2 { - @apply text-2xl border-b-2 dark:border-b-white border-b-gray-400 py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-300 to-orange-200; + @apply text-2xl border-b-2 dark:border-b-white border-b-gray-400 py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-300 to-orange-200 mb-4 mt-4; } h3 { @apply text-2xl bg-white text-right underline py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-200 to-orange-300 pr-4; @@ -23,6 +23,12 @@ h4 { @apply text-2xl text-right underline py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-200 to-orange-300 pr-4; } + pre { + @apply bg-base-300 border-white border-l-2 my-4 px-2 py-2 pl-4 + } + ul { + @apply my-2 + } } @tailwind components; @tailwind utilities; diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 68e0ef3..81c9b9b 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -6,19 +6,19 @@ export const shuffleArray = (array: any[]) => { }; export const fetchMarkdownGuides = async () => { -const allPostFiles = import.meta.glob('/src/routes/guides/*.md'); -const iterablePostFiles = Object.entries(allPostFiles); + const allGuideFiles = import.meta.glob('/src/routes/guides/*.md'); + const iterableGuideFiles = Object.entries(allGuideFiles); + // Also return the content + const allGuides = await Promise.all( + iterableGuideFiles.map(async ([path, resolver]) => { + const { metadata } = await (resolver() as Promise<{ metadata: any }>); + const guidePath = path.slice(11, -3); + return { + meta: metadata, + path: guidePath, + }; + }) + ); -const allPosts = await Promise.all( - iterablePostFiles.map(async ([path, resolver]) => { - const { metadata } = await (resolver() as Promise<{ metadata: any }>); - const postPath = path.slice(11, -3); - return { - meta: metadata, - path: postPath - }; - }) -); - - return allPosts; + return allGuides; }; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 50745c6..5d93a95 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -38,14 +38,14 @@ ? 'flex' : 'hidden'}" > - Évènements - Membres - Outils - Guides - Réseaux - Ressources - Presse - Contact + Évènements + Membres + Outils + Guides + Réseaux + Ressources + Presse + Contact @@ -66,31 +66,31 @@
@@ -101,10 +101,8 @@ diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index e69de29..c8cacf0 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -0,0 +1 @@ +export const prerender = true; \ No newline at end of file diff --git a/src/routes/api/guides/+server.ts b/src/routes/api/guides/+server.ts index d49673f..2838a14 100644 --- a/src/routes/api/guides/+server.ts +++ b/src/routes/api/guides/+server.ts @@ -4,9 +4,10 @@ import { json } from '@sveltejs/kit'; export const GET = async () => { const allPosts = await fetchMarkdownGuides(); - const sortedPosts = allPosts.sort((a, b) => { + const sortedGuides = allPosts.sort((a, b) => { return new Date(b.meta.date).getTime() - new Date(a.meta.date).getTime(); }); - return json(sortedPosts); + console.log(sortedGuides) + return json(sortedGuides); }; diff --git a/src/routes/contacts/+page.svelte.md b/src/routes/contacts/+page.svelte.md index 05f365a..e10e884 100644 --- a/src/routes/contacts/+page.svelte.md +++ b/src/routes/contacts/+page.svelte.md @@ -7,4 +7,13 @@ # Contact -Pour proposer un article, référez-vous à l'article Proposer un article. Nous acceptons toutes les collaborations.
+