Skip to content

Commit a14b785

Browse files
Enhance dynamic page title generation with fallback to app name (#126)
* Update app.tsx The page component will only show the app name if it doesn't provide a title. * Update ssr.tsx The page component will only show the app name if it doesn't provide a title.
1 parent f1c4c46 commit a14b785

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

resources/js/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { initializeTheme } from './hooks/use-appearance';
88
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
99

1010
createInertiaApp({
11-
title: (title) => `${title} - ${appName}`,
11+
title: (title) => title ? `${title} - ${appName}` : appName,
1212
resolve: (name) => resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob('./pages/**/*.tsx')),
1313
setup({ el, App, props }) {
1414
const root = createRoot(el);

resources/js/ssr.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ createServer((page) =>
1010
createInertiaApp({
1111
page,
1212
render: ReactDOMServer.renderToString,
13-
title: (title) => `${title} - ${appName}`,
13+
title: (title) => title ? `${title} - ${appName}` : appName,
1414
resolve: (name) => resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob('./pages/**/*.tsx')),
1515
setup: ({ App, props }) => {
1616
/* eslint-disable */

0 commit comments

Comments
 (0)