Skip to content

Commit

Permalink
docs: search filtering and move compiler macros (#3316)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbieGoede authored Jan 17, 2025
1 parent ea9d126 commit e8d7dc4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions docs/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ provide('navigation', navigation)
const router = useRouter()
const isV7Docs = computed(() => router.currentRoute.value.path.includes('/docs/v7'))
const isV9Docs = computed(() => router.currentRoute.value.path.includes('/docs/v9'))
const isV8Docs = computed(() => router.currentRoute.value.path.includes('/docs/v8'))
// Search
const { data: files } = useLazyFetch<ParsedContent[]>('/api/search.json', {
Expand All @@ -28,21 +28,21 @@ const { data: files } = useLazyFetch<ParsedContent[]>('/api/search.json', {
})
const v7DocsRE = /^\/docs\/v7/
const v9DocsRE = /^\/docs\/v9/
const v8DocsRE = /^\/docs\/v8/
const navigationV7 = computed(() => navigation.value?.[0].children.filter(x => v7DocsRE.test(String(x._path))))
const navigationV9 = computed(() => navigation.value?.[0].children.filter(x => v9DocsRE.test(String(x._path))))
const navigationV8 = computed(() =>
const navigationV8 = computed(() => navigation.value?.[0].children.filter(x => v8DocsRE.test(String(x._path))))
const navigationV9 = computed(() =>
navigation.value?.[0].children.filter(x => {
const to = String(x._path)
return !v9DocsRE.test(to) && !v7DocsRE.test(to)
return !v8DocsRE.test(to) && !v7DocsRE.test(to)
})
)
const currentVersionNavigation = computed(() => {
if (isV7Docs.value) return navigationV7.value
if (isV9Docs.value) return navigationV9.value
return navigationV8.value
if (isV8Docs.value) return navigationV8.value
return navigationV9.value
})
// Header
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Compiler Macros
description: Compiler Macros for Nuxt i18n module
title: defineI18nRoute
---

`defineI18nRoute()`{lang="ts"} is a compiler macro that you can use to set custom route paths for your **page** components located in the `pages/` directory (unless [set otherwise](https://nuxt.com/docs/api/configuration/nuxt-config#pages-1)). This way you can set custom route paths for each static or dynamic route of your Nuxt application.
Expand Down
1 change: 1 addition & 0 deletions docs/content/docs/7.compiler-macros/_dir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: Compiler Macros

0 comments on commit e8d7dc4

Please sign in to comment.