From 7a71a66dc7a71e58071d6a40466e0f6c415caf3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyril=20=C5=A0ebek?= Date: Mon, 8 Jul 2024 23:01:44 +0200 Subject: [PATCH] Enabled SSR with pre-renders - Enable server output mode - Pre-render for (almost) every .astro file - Fixed custom middleware --- astro.config.mjs | 2 +- src/components/About.astro | 2 ++ src/components/AboutModule.astro | 5 +++-- src/components/CompositionsList.astro | 1 + src/components/FloatingLinks.astro | 1 + src/components/Hero.astro | 1 + src/components/Navbar.astro | 1 + src/components/NavbarSkeleton.astro | 3 +++ src/components/PostsList.astro | 2 +- src/components/Showcase.astro | 1 + src/components/SingleCompositionCard.astro | 1 + src/components/SinglePostCard.astro | 2 +- src/middleware.js | 12 ++++++------ src/pages/404.astro | 6 ++---- 14 files changed, 25 insertions(+), 15 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index b40dcd2..676d7db 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -9,7 +9,7 @@ import react from "@astrojs/react"; // https://astro.build/config export default defineConfig({ - output: "hybrid", + output: "server", adapter: node({ mode: "standalone", }), diff --git a/src/components/About.astro b/src/components/About.astro index 2959b86..af7b2a4 100644 --- a/src/components/About.astro +++ b/src/components/About.astro @@ -1,4 +1,6 @@ --- +export const prerender = true; + import SinglePage from "../layouts/SinglePage.astro"; import AboutModule from "./AboutModule.astro"; diff --git a/src/components/AboutModule.astro b/src/components/AboutModule.astro index e01f5bb..f80e7a6 100644 --- a/src/components/AboutModule.astro +++ b/src/components/AboutModule.astro @@ -1,5 +1,6 @@ - --- -const { row, flipped, image, alt } = Astro.props; +--- +export const prerender = true; +const { row, flipped, image } = Astro.props; ---
diff --git a/src/components/CompositionsList.astro b/src/components/CompositionsList.astro index 44456f7..2ef845c 100644 --- a/src/components/CompositionsList.astro +++ b/src/components/CompositionsList.astro @@ -1,4 +1,5 @@ --- +export const prerender = true; import SingleCompositionCard from "./SingleCompositionCard.astro"; import { Separator } from "./ui/separator"; diff --git a/src/components/FloatingLinks.astro b/src/components/FloatingLinks.astro index cfa04e9..a3ba7cd 100644 --- a/src/components/FloatingLinks.astro +++ b/src/components/FloatingLinks.astro @@ -1,4 +1,5 @@ --- +export const prerender = true; import { ContactButton } from "./ContactButton"; --- diff --git a/src/components/Hero.astro b/src/components/Hero.astro index 0be65ee..6d05867 100644 --- a/src/components/Hero.astro +++ b/src/components/Hero.astro @@ -1,4 +1,5 @@ --- +export const prerender = true; import SinglePage from "../layouts/SinglePage.astro"; import { getLangFromUrl, useTranslations } from "../i18n/utils"; diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index 3750bd2..df1add5 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -1,4 +1,5 @@ --- +export const prerender = true; import { ThemeSelector } from "./ThemeSelector" import NavbarSkeleton from "./NavbarSkeleton.astro"; import { LangSwitcher } from "./LangSwitcher"; diff --git a/src/components/NavbarSkeleton.astro b/src/components/NavbarSkeleton.astro index 5832843..927d0e7 100644 --- a/src/components/NavbarSkeleton.astro +++ b/src/components/NavbarSkeleton.astro @@ -1,3 +1,6 @@ +--- +export const prerender = true; +---