improve page title default (#4278)

This commit is contained in:
Khaleel Al-Adhami 2024-10-30 17:48:23 -07:00 committed by GitHub
parent a2126beca1
commit e5e494108e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -197,8 +197,16 @@ def make_default_page_title(app_name: str, route: str) -> str:
Returns:
The default page title.
"""
title = constants.DefaultPage.TITLE.format(app_name, route)
return to_title_case(title, " ")
route_parts = [
part
for part in route.split("/")
if part and not (part.startswith("[") and part.endswith("]"))
]
title = constants.DefaultPage.TITLE.format(
app_name, route_parts[-1] if route_parts else constants.PageNames.INDEX_ROUTE
)
return to_title_case(title)
def _escape_js_string(string: str) -> str: