Skip to content

Commit

Permalink
Update page title retrieval logic
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Dec 20, 2024
1 parent d796a00 commit 6f8b337
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions frontend/src/routes/(app)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@
import commandPaletteOpen from '$lib/components/CommandPalette/CommandPalette.svelte';
let sidebarOpen = true;
function getPageTitle(): string {
return safeTranslate(
$page.data.title || $page.data.str || $page.data.name || $breadcrumbs.length > 1
? $breadcrumbs[$breadcrumbs.length - 1]?.label
: $page.url.pathname.split('/').pop()
);
}
$: classesSidebarOpen = (open: boolean) => (open ? 'ml-7 lg:ml-64' : 'ml-7');
$: {
$pageTitle = safeTranslate(
$page.data.title ||
$page.data.str ||
$page.data.name ||
$breadcrumbs[1]?.label ||
$page.url.pathname.split('/').pop()
);
$pageTitle = getPageTitle();
if ($breadcrumbs.length < 2)
breadcrumbs.push([{ label: $pageTitle, href: $page.url.pathname }]);
}
Expand Down

0 comments on commit 6f8b337

Please sign in to comment.