Skip to content

Enhance dynamic page title generation with fallback to app name #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bishwajitcadhikary
Copy link
Contributor

Updated the title function to support pages without a custom title.
Now, if no title is provided, it will default to displaying only the appName.
This improves consistency across routes and prevents malformed titles like - AppName.

Before:

title: (title) => `${title} - ${appName}`

After:

title: (title) => title ? `${title} - ${appName}` : appName

The page component will only show the app name if it doesn't provide a title.
@Plytas
Copy link

Plytas commented Jun 10, 2025

I swear I saw this PR being merged before. Turns out it was just for app.ts, not ssr.ts 👍
#140

@Plytas
Copy link

Plytas commented Jun 10, 2025

Question to the team @taylorotwell @tnylea

Since both title and page resolver seems to be the same in both app.ts and ssr.ts, would it make sense to abstract them in let's say /resources/js/lib/utils.ts (or some other place)? This way it would be reused and most importantly consistent, without having to change it in 2 places all the time.

@bishwajitcadhikary
Copy link
Contributor Author

I swear I saw this PR being merged before. Turns out it was just for app.ts, not ssr.ts 👍
#140

You're right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants