From f0b6160b93909f8f639bddd25a867ca3a7d103b7 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 16 Jun 2023 20:55:07 +1000 Subject: [PATCH] change index title --- theme.config.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/theme.config.tsx b/theme.config.tsx index 55f81822..2f4fc64a 100644 --- a/theme.config.tsx +++ b/theme.config.tsx @@ -25,12 +25,14 @@ function useHead() { function useNextSeoProps() { const { asPath } = useRouter(); const arr = asPath.replace(/[-_]/g, ' ').split('/'); - const category = arr[1][0] !== '#' && arr[1] - const rawTitle = arr[arr.length - 1] - const title = /[a-z]/.test(rawTitle) && /[A-Z]/.test(rawTitle) ? rawTitle : '%s' + const category = (arr[1][0] !== '#' && arr[1]) || 'Overextended'; + const rawTitle = arr[arr.length - 1]; + const title = /[a-z]/.test(rawTitle) && /[A-Z]/.test(rawTitle) ? rawTitle : '%s'; return { - titleTemplate: `${title} - ${rawTitle === category ? 'Overextended' : category.replace(/(^\w|\s\w)/g, m => m.toUpperCase())}`, + titleTemplate: `${title} - ${ + rawTitle === category ? 'Documentation' : category.replace(/(^\w|\s\w)/g, (m) => m.toUpperCase()) + }`, }; }