---
title: "useDocsRoute"
description: "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."
canonical_url: "https://docs.mhaibaraai.cn/en/docs/reference/composables/use-docs-route"
---
# 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`](https://docs.mhaibaraai.cn/en/docs/reference/composables/use-movk-i18n). The default header uses it to decide whether to show the section bar and reading progress.

## Usage

```vue [app/components/FooterRight.vue]
<script setup lang="ts">
const isDocsRoute = useDocsRoute()
</script>

<template>
  <span v-if="isDocsRoute">Docs</span>
</template>
```

## Signature

```ts
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

See commit history for [layer/app/composables/useDocsRoute.ts](https://github.com/mhaibaraai/movk-nuxt-docs/commits/main/layer/app/composables/useDocsRoute.ts).

---

- [GitHub](https://github.com/mhaibaraai/movk-nuxt-docs/blob/main/layer/app/composables/useDocsRoute.ts)


## Sitemap

See the full [sitemap](https://docs.mhaibaraai.cn/sitemap.md) for all pages.
