feat: improve page title handling by limiting path segments for meta title lookup
This commit is contained in:
parent
deb2004039
commit
d538c56d26
@ -23,9 +23,9 @@ export const links: Route.LinksFunction = () => [
|
|||||||
|
|
||||||
export const meta = ({ location }: Route.MetaArgs) => {
|
export const meta = ({ location }: Route.MetaArgs) => {
|
||||||
const { pathname } = location
|
const { pathname } = location
|
||||||
const pageTitle = META_TITLE_CONFIG.find(
|
const segments = pathname.split('/')
|
||||||
(meta) => meta.path === pathname,
|
const path = segments.length > 4 ? segments.slice(0, 4).join('/') : pathname
|
||||||
)?.title
|
const pageTitle = META_TITLE_CONFIG.find((meta) => meta.path === path)?.title
|
||||||
const metaTitle = APP.title
|
const metaTitle = APP.title
|
||||||
const title = `${pageTitle ? `${pageTitle} - ` : ''}${metaTitle}`
|
const title = `${pageTitle ? `${pageTitle} - ` : ''}${metaTitle}`
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user