feat(web-react) improved webpage title generation logic (#11773)

This commit is contained in:
Jay 2024-11-08 15:42:03 -05:00 committed by GitHub
parent 7761394d68
commit a559c7ee5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -78,7 +78,11 @@ export const SearchablePage = ({ onSearch, onAutoComplete, children }: Props) =>
const formattedPath = location.pathname
.split('/')
.filter((word) => word !== '')
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.map((rawWord) => {
// ie. personal-notifications -> Personal Notifications
const words = rawWord.split('-');
return words.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
})
.join(' | ');
if (formattedPath) {