Skip to content

Commit

Permalink
docs: configure redirects from vuepress site
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmaribojoc committed Apr 9, 2024
1 parent 5cad7cf commit c9ea868
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
6 changes: 0 additions & 6 deletions apps/docs/components/middleware/getting-started.global.ts

This file was deleted.

15 changes: 15 additions & 0 deletions apps/docs/components/middleware/redirects.global.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default defineNuxtRouteMiddleware((to, from) => {
if (to.path === '/getting-started') {
const { selectedFramework } = useFramework();
return navigateTo('/getting-started/' + selectedFramework.value.name);
}
let path = to.path;

// remove framework (vue/react) from paths for customization
if (path.includes('/customization') || path.includes('/browser-support') || path.includes('components.html') || path.includes('blocks.html') || path.includes('hooks.html')) {
path = path.replace('/vue', '').replace('/react', '');
}
if (path.includes('.html')) {
return navigateTo(path.replace('.html', '').toLowerCase());
}
});
2 changes: 1 addition & 1 deletion apps/docs/components/pages/[framework]/blocks/[block].vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ const route = useRoute();

<template>
<NuxtLayout name="fullscreen">
<ContentDoc :path="`/_blocks/${route.params.block}`" />
<ContentDoc :path="`/_blocks/${route.params.block.toString().toLowerCase()}`" />
</NuxtLayout>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ const route = useRoute();

<template>
<NuxtLayout name="fullscreen">
<ContentDoc :path="`/_components/${route.params.component}`" />
<ContentDoc :path="`/_components/${route.params.component.toString().toLowerCase()}`" />
</NuxtLayout>
</template>
2 changes: 1 addition & 1 deletion apps/docs/components/pages/[framework]/hooks/[hook].vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ const route = useRoute();

<template>
<NuxtLayout name="fullscreen">
<ContentDoc :path="`/_hooks/${route.params.hook}`" />
<ContentDoc :path="`/_hooks/${route.params.hook.toString().toLowerCase()}`" />
</NuxtLayout>
</template>

0 comments on commit c9ea868

Please sign in to comment.