Add middleware for background and browser title

This commit is contained in:
BlossomiShymae
2024-10-10 15:08:25 -05:00
parent 06f8e33000
commit 464af54611
4 changed files with 23 additions and 9 deletions

View File

@@ -0,0 +1,7 @@
export default defineNuxtRouteMiddleware((to, from) => {
useHead({
htmlAttrs: {
style: to.fullPath == "/" ? "background: url('/clean-cuts/img/background.jpg');" : "background: rgb(21, 11, 48)"
},
});
});

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