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