change index title

This commit is contained in:
Linden committed 2023-06-16 20:55:07 +10:00
1 parent 446ae4e312
commit f0b6160b93
1 file changed
+6 -4
+6 -4
View File
@@ -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())
}`,
};
}