Files
clean-cuts/middleware/title.global.ts
2024-10-10 15:08:25 -05:00

12 lines
355 B
TypeScript

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(" • ")
})
});