mirror of
https://github.com/BlossomiShymae/clean-cuts.git
synced 2025-12-06 18:20:47 +01:00
Add middleware for background and browser title
This commit is contained in:
12
middleware/title.global.ts
Normal file
12
middleware/title.global.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
useHead({
|
||||
title: to.fullPath == "/" ? "Clean Cuts" : to.fullPath
|
||||
.split("/")
|
||||
.filter(x => x != "")
|
||||
.map(x => x
|
||||
.split("-") // Remove hypens
|
||||
.map(x => x.charAt(0).toUpperCase() + x.slice(1)) // Titlecase words
|
||||
.join(" "))
|
||||
.join(" • ")
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user