Skip to content

Commit

Permalink
feat(web-react) improved webpage title generation logic (#11773)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayacryl authored Nov 8, 2024
1 parent 7761394 commit a559c7e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion datahub-web-react/src/app/search/SearchablePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a559c7e

Please sign in to comment.