mirror of
https://github.com/BlossomiShymae/clean-cuts.git
synced 2025-12-06 10:10:47 +01:00
Add middleware for background and browser title
This commit is contained in:
7
middleware/background.global.ts
Normal file
7
middleware/background.global.ts
Normal 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)"
|
||||
},
|
||||
});
|
||||
});
|
||||
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