2022-11-29 21:51:52 +01:00
|
|
|
<script setup lang="ts">
|
2022-12-04 20:56:33 +01:00
|
|
|
import { hasProtocol, parseURL } from 'ufo'
|
2022-11-29 21:51:52 +01:00
|
|
|
|
|
|
|
definePageMeta({
|
|
|
|
middleware: async (to) => {
|
2022-12-04 20:56:33 +01:00
|
|
|
const permalink = Array.isArray(to.params.permalink)
|
|
|
|
? to.params.permalink.join('/')
|
|
|
|
: to.params.permalink
|
2022-11-29 21:51:52 +01:00
|
|
|
|
2022-12-04 20:56:33 +01:00
|
|
|
if (hasProtocol(permalink)) {
|
|
|
|
const { host, pathname } = parseURL(permalink)
|
2022-12-01 23:59:08 +01:00
|
|
|
|
2022-12-20 16:56:54 +01:00
|
|
|
if (host)
|
|
|
|
return `/${host}${pathname}`
|
2022-11-29 21:51:52 +01:00
|
|
|
}
|
|
|
|
|
2022-12-04 20:56:33 +01:00
|
|
|
// We've reached a page that doesn't exist
|
|
|
|
return false
|
2022-11-29 21:51:52 +01:00
|
|
|
},
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div />
|
|
|
|
</template>
|