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()) + }`, }; }