routes/index: use m.home_title() + pass undefined locale to findPosts
Title was hardcoded to the German string when I migrated the rest of the site to paraglide — the rest of the site looked correct on /en/ because the localized meta came from the root route's head() which DID use m.foo(). Index also passed 'de' literally to findPosts, ignoring the request locale.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { findPosts } from "@/lib/cms";
|
||||
import { m } from "@/paraglide/messages";
|
||||
import Landing from "@/sections/Landing";
|
||||
import LatestPosts from "@/sections/LatestPosts";
|
||||
|
||||
@@ -7,7 +8,7 @@ export const Route = createFileRoute("/")({
|
||||
loader: async () => {
|
||||
// Soft-fail on CMS hiccups so the hero still renders.
|
||||
try {
|
||||
const { docs } = await findPosts("de", 2);
|
||||
const { docs } = await findPosts(undefined, 2);
|
||||
return { posts: docs };
|
||||
} catch {
|
||||
return { posts: [] };
|
||||
@@ -15,7 +16,7 @@ export const Route = createFileRoute("/")({
|
||||
},
|
||||
component: HomePage,
|
||||
head: () => ({
|
||||
meta: [{ title: "unom - Kreative Webentwicklung" }],
|
||||
meta: [{ title: m.home_title() }],
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user