From ca7db52f7b965af146cf2140d239bcc31f2c952a Mon Sep 17 00:00:00 2001 From: Luke Brooker Date: Fri, 15 Mar 2024 13:35:20 +1000 Subject: [PATCH] Fix page titles --- .gitignore | 2 ++ src/app/_layout.tsx | 2 +- src/utils/getCurrentPath.ts | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4279d73..2968ebb 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,8 @@ apps/kitchen-sink/ios .tamagui +.obsidian + .idea .env diff --git a/src/app/_layout.tsx b/src/app/_layout.tsx index 5d13a6a..7c6abfa 100644 --- a/src/app/_layout.tsx +++ b/src/app/_layout.tsx @@ -38,8 +38,8 @@ export default function RootLayout () { const colorScheme = 'light' const pathname = usePathname() + const currentPath = getCurrentPath(pathname, false) - const currentPath = getCurrentPath(pathname) const { image = {}, title = site.title, diff --git a/src/utils/getCurrentPath.ts b/src/utils/getCurrentPath.ts index ce5c893..166041b 100644 --- a/src/utils/getCurrentPath.ts +++ b/src/utils/getCurrentPath.ts @@ -9,5 +9,6 @@ export function ensureSlash (inputPath: string, needsSlash: boolean): string { } } -export const getCurrentPath = (pathname: string) => - ensureSlash(pathname || '', true) || 'home' +export const getCurrentPath = (pathname: string, needsSlash: boolean = true) => + ensureSlash(pathname || '', needsSlash) || 'home' +