mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
improve index page titles
This commit is contained in:
1 parent
88ae9acb97
commit
446ae4e312
1 file changed
+4
-3
+4
-3
@@ -25,11 +25,12 @@ function useHead() {
|
||||
function useNextSeoProps() {
|
||||
const { asPath } = useRouter();
|
||||
const arr = asPath.replace(/[-_]/g, ' ').split('/');
|
||||
const category = arr[1].replace(/(^\w|\s\w)/g, m => m.toUpperCase()) || 'Overextended'
|
||||
const title = arr[arr.length - 1]
|
||||
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'
|
||||
|
||||
return {
|
||||
titleTemplate: `${/[a-z]/.test(title) && /[A-Z]/.test(title) ? title : '%s'} - ${category}`,
|
||||
titleTemplate: `${title} - ${rawTitle === category ? 'Overextended' : category.replace(/(^\w|\s\w)/g, m => m.toUpperCase())}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user