@@ -24,10 +24,13 @@ Take a navigation node and will resolve the first available path from that node.
24
24
25
25
It can be useful to build nested navigations systems.
26
26
27
- ``` ts
28
- const { navigation } = useContent ()
27
+ ``` vue
28
+ <script setup>
29
+ const { navBottomLink } = useContentHelpers()
30
+ const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation())
29
31
30
32
const path = navBottomLink(navigation.value)
33
+ </script>
31
34
```
32
35
33
36
## ` navDirFromPath() `
@@ -36,12 +39,14 @@ This function will take a path and will resolve the first available navigation n
36
39
37
40
It can be useful to find the current directory of a navigation node.
38
41
39
- ``` ts
42
+ ``` vue
43
+ <script setup>
40
44
const route = useRoute()
41
-
42
- const { navigation } = useContent ( )
45
+ const { navDirFromPath } = useContentHelpers()
46
+ const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation() )
43
47
44
48
const dir = navDirFromPath(route.path, navigation.value)
49
+ </script>
45
50
```
46
51
47
52
## ` navPageFromPath() `
@@ -50,12 +55,14 @@ This function will take a path and will resolve the first available navigation p
50
55
51
56
It can be useful to find the current navigation node the page you're browsing.
52
57
53
- ``` ts
58
+ ``` vue
59
+ <script setup>
54
60
const route = useRoute()
55
-
56
- const { navigation } = useContent ( )
61
+ const { navPageFromPath } = useContentHelpers()
62
+ const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation() )
57
63
58
64
const page = navPageFromPath(route.path, navigation.value)
65
+ </script>
59
66
```
60
67
61
68
## ` navKeyFromPath() `
@@ -64,10 +71,12 @@ This function will take a path and will resolve a specific key from that path.
64
71
65
72
It can be useful when you want to add a fallback on the ` _dir.yml ` value of a key in a page.
66
73
67
- ``` ts
74
+ ``` vue
75
+ <script setup>
68
76
const route = useRoute()
69
-
70
- const { navigation } = useContent ( )
77
+ const { navKeyFromPath } = useContentHelpers()
78
+ const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation() )
71
79
72
80
const layout = navKeyFromPath(route.path, 'layout', navigation.value)
81
+ </script>
73
82
```
0 commit comments