useDocsRoute

Check whether the current route is a docs page, covering /docs/* for the default locale and /{locale}/docs/* for others. Use it in site-wide components such as a custom header or footer that should show something only on docs pages.

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

NameTypeDescription
(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
Copyright © 2024 - 2026