useDocsRoute
Check whether the current route is a docs page, including routes with locale prefixes.
useDocsRoute() checks the route against the current locale's docsRoot. The default header uses it to decide whether to show the section bar and reading progress.
Usage
app/components/FooterRight.vue
<script setup lang="ts">
const isDocsRoute = useDocsRoute()
</script>
<template>
<span v-if="isDocsRoute">Docs</span>
</template>
Signature
function useDocsRoute(): ComputedRef<boolean>
Return Value
| Name | Type | Description |
|---|---|---|
| (return value) | ComputedRef<boolean> | true when the current path starts with ${docsRoot}/ |
Notes
The docs root itself (/docs) does not start with /docs/, so it returns false; that path is usually redirected to the first page.
Changelog
No recent changes