Skip to content

Commit

Permalink
fix: 🐛 lang path without trailing backslash returns 404
Browse files Browse the repository at this point in the history
fixes #15
  • Loading branch information
DerZade committed Nov 26, 2024
1 parent f86adc8 commit a470da6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/[lang].md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script setup>
import { useRouter, useData } from 'vitepress'

const router = useRouter();
const { params } = useData()

router.go(`/${params.value.lang}/`)
</script>
9 changes: 9 additions & 0 deletions src/[lang].paths.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import config from '../.vitepress/config.mts';

const SUPPORTED_LANGS = Object.keys(config.locales ?? {});

export default {
async paths() {
return SUPPORTED_LANGS.map((lang) => ({ params: { lang } }));
},
};

0 comments on commit a470da6

Please sign in to comment.