Fix pre-rendering
Some checks failed
Build and deploy updated apps / Build & deploy (push) Failing after 1m6s
Some checks failed
Build and deploy updated apps / Build & deploy (push) Failing after 1m6s
This commit is contained in:
parent
dbb9cab101
commit
4a872ad1c6
12
apps/panoramablick-saalbach.at/pages/index.vue
Normal file
12
apps/panoramablick-saalbach.at/pages/index.vue
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!-- This page just exists to ensure all pages are found during pre-rendered -->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NuxtLink :to="buildPrefix(preferredLocale, preferredVariant)"></NuxtLink>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
definePageMeta({layout: false}) // crashes otherwise if multiple languages/variants
|
||||||
|
|
||||||
|
const {buildPrefix} = useContentPrefix()
|
||||||
|
const {preferredLocale, preferredVariant} = useContentPreference()
|
||||||
|
</script>
|
||||||
@ -1,6 +1,10 @@
|
|||||||
export default defineNuxtRouteMiddleware((to, from) => {
|
export default defineNuxtRouteMiddleware((to, from) => {
|
||||||
// important: routes do not exist in middleware, never (in)directly use e.g. useRoute
|
// important: routes do not exist in middleware, never (in)directly use e.g. useRoute
|
||||||
|
|
||||||
|
if (import.meta.server) {
|
||||||
|
return // it will interfere with pre-rendering otherwise
|
||||||
|
}
|
||||||
|
|
||||||
const {getLocaleVariant, buildPrefix} = useContentPrefix()
|
const {getLocaleVariant, buildPrefix} = useContentPrefix()
|
||||||
const localeVariant = getLocaleVariant(to.path)
|
const localeVariant = getLocaleVariant(to.path)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user