fix: page layout breaks when page name matches the css class name (#696) (#699)

fix: #696 

To fix the issue, make the page name inside VPDoc use a complete path.
pull/731/head
Divyansh Singh 3 years ago committed by GitHub
parent 305bcc02e6
commit 9c0ed9397f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,16 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue' import { useRoute } from 'vitepress'
import { useData } from 'vitepress'
import { useSidebar } from '../composables/sidebar' import { useSidebar } from '../composables/sidebar'
import VPDocAside from './VPDocAside.vue' import VPDocAside from './VPDocAside.vue'
import VPDocFooter from './VPDocFooter.vue' import VPDocFooter from './VPDocFooter.vue'
const { page } = useData() const { path } = useRoute()
const { hasSidebar } = useSidebar() const { hasSidebar } = useSidebar()
const pageName = computed(() => { const pageName = path.replace(/[./]+/g, '_').replace(/_html$/, '')
return page.value.relativePath.slice(0, page.value.relativePath.indexOf('/'))
})
</script> </script>
<template> <template>

Loading…
Cancel
Save