diff --git a/astro.config.mjs b/astro.config.mjs index 676d7db..76c6fcd 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: "server", + output: "hybrid", adapter: node({ mode: "standalone", }), @@ -45,7 +45,10 @@ export default defineConfig({ }, ], defaultLocale: "en", - routing: "manual", + routing: { + redirectToDefaultLocale: true, + prefixDefaultLocale: true + }, fallback: { de: "en", fr: "en", diff --git a/src/components/CompositionsList.astro b/src/components/CompositionsList.astro index 2ef845c..894e81f 100644 --- a/src/components/CompositionsList.astro +++ b/src/components/CompositionsList.astro @@ -1,5 +1,5 @@ --- -export const prerender = true; +export const prerender = false; import SingleCompositionCard from "./SingleCompositionCard.astro"; import { Separator } from "./ui/separator"; diff --git a/src/components/ContactButton.jsx b/src/components/ContactButton.jsx index ce2fc59..0e8922f 100644 --- a/src/components/ContactButton.jsx +++ b/src/components/ContactButton.jsx @@ -1,4 +1,3 @@ -export const prerender = true; import * as React from "react" diff --git a/src/components/NavButton.jsx b/src/components/NavButton.jsx index 4855509..6a50dc7 100644 --- a/src/components/NavButton.jsx +++ b/src/components/NavButton.jsx @@ -14,7 +14,6 @@ import { } from "./ui/tooltip" export function NavButton({ selected, variant, tooltip }) { - return ( diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index df1add5..de4a355 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -1,5 +1,5 @@ --- -export const prerender = true; +export const prerender = false; import { ThemeSelector } from "./ThemeSelector" import NavbarSkeleton from "./NavbarSkeleton.astro"; import { LangSwitcher } from "./LangSwitcher"; @@ -32,7 +32,7 @@ const t = useTranslations(getLangFromUrl(Astro.url)); - + diff --git a/src/components/PostsList.astro b/src/components/PostsList.astro index b037599..d41c3b6 100644 --- a/src/components/PostsList.astro +++ b/src/components/PostsList.astro @@ -1,6 +1,6 @@ --- -import SinglePostCard from "./SinglePostCard.astro"; export const prerender = true; +import SinglePostCard from "./SinglePostCard.astro"; const { filteredPosts } = Astro.props; --- diff --git a/src/components/ShowcaseTabs.jsx b/src/components/ShowcaseTabs.jsx index 137e388..947b1a4 100644 --- a/src/components/ShowcaseTabs.jsx +++ b/src/components/ShowcaseTabs.jsx @@ -13,8 +13,6 @@ import { TabsTrigger, } from "../components/ui/tabs"; -export const prerender = true; - export function ShowcaseTabs({ currentLocale }) { const t = useTranslations(currentLocale); const showcase = t("showcase"); diff --git a/src/components/SingleCompositionCard.astro b/src/components/SingleCompositionCard.astro index dcae6b0..2ab37ca 100644 --- a/src/components/SingleCompositionCard.astro +++ b/src/components/SingleCompositionCard.astro @@ -1,5 +1,5 @@ --- -export const prerender = true; +export const prerender = false; import { Card, CardContent, diff --git a/src/components/ThemeSelector.jsx b/src/components/ThemeSelector.jsx index f2471a4..95817b2 100644 --- a/src/components/ThemeSelector.jsx +++ b/src/components/ThemeSelector.jsx @@ -17,8 +17,6 @@ import { TooltipTrigger, } from "./ui/tooltip" - export const prerender = true; - // Please note that clang = lang, it's just for more confusion export function ThemeSelector({ tooltip }) { function getTheme() { diff --git a/src/middleware.js b/src/middleware.js deleted file mode 100644 index a97410b..0000000 --- a/src/middleware.js +++ /dev/null @@ -1,31 +0,0 @@ -import { defineMiddleware, sequence } from "astro:middleware"; -import { middleware } from "astro:i18n"; // Astro's own i18n routing config - -export const prerender = false - -const langs = ["en", "de", "cs", "fr"] - -export const userMiddleware = defineMiddleware((ctx, next) => { - - const exceptions = ["/api", "/public"] - - // If path is in exceptions (i.e. api or public) return default middleware to handle it - if (exceptions.includes(ctx.url.pathname) ) { - return next(); - - // If no lang is set => set to english (some pages are language-les exceptions) - } else if ( !langs.some(item => ctx.url.href.includes(item)) ) { - return Response.redirect(`${ctx.url.protocol}${ctx.url.host}/en${ctx.url.pathname}`); - - } else { - return next(); - } -}); - -export const onRequest = sequence( - userMiddleware, - middleware({ - redirectToDefaultLocale: false, - prefixDefaultLocale: true, - }) -); diff --git a/src/pages/[lang]/blog/index.astro b/src/pages/[lang]/blog/index.astro index 93fcc94..152d243 100644 --- a/src/pages/[lang]/blog/index.astro +++ b/src/pages/[lang]/blog/index.astro @@ -8,7 +8,7 @@ import PostsList from "../../../components/PostsList.astro"; import { getLangFromUrl, useTranslations } from "../../../i18n/utils"; import { Separator } from "../../../components/ui/separator"; -const t = useTranslations(getLangFromUrl(Astro.url)) +const t = useTranslations(getLangFromUrl(Astro.url)); export async function getStaticPaths() { return ["en", "fr", "cs", "de"].map((lang) => { @@ -19,16 +19,23 @@ var posts = await getBlogPosts(); var filtered_posts = posts.filter( (post) => post.data.language == Astro.currentLocale, ); - --- - +
-

{t("blog")["visible"]}

-

{t("blog")["description"]}

- - +

+ {t("blog")["visible"]} +

+

+ {t("blog")["description"]} +

+ +
-
\ No newline at end of file +
diff --git a/src/pages/[lang]/music/index.astro b/src/pages/[lang]/music/index.astro index e7564ea..ea52adf 100644 --- a/src/pages/[lang]/music/index.astro +++ b/src/pages/[lang]/music/index.astro @@ -1,16 +1,12 @@ --- -export const prerender = true; - +export const prerender = false; import MainLayout from "../../../layouts/MainLayout.astro"; - -//@ts-ignore +import { getCompositions } from "../../../content/config"; +import SinglePageBlogMode from "../../../layouts/SinglePageBlogMode.astro"; +import CompositionsList from "../../../components/CompositionsList.astro"; import { getLangFromUrl, useTranslations } from "../../../i18n/utils"; import { Separator } from "../../../components/ui/separator"; -import SinglePageBlogMode from "../../../layouts/SinglePageBlogMode.astro"; -import { getCompositions } from "../../../content/config"; -import CompositionsList from "../../../components/CompositionsList.astro"; - const t = useTranslations(getLangFromUrl(Astro.url)); export async function getStaticPaths() { @@ -19,22 +15,21 @@ export async function getStaticPaths() { }); } -const songs = await getCompositions() +var songs = await getCompositions() +songs = songs.reverse() ---

{t("music")["title"]}

{t("music")["description"]}

- { // @ts-ignore } - +