composables
useContentHelpers()
Helpers to interact with the navigation object.
Usage
<script setup lang="ts">const { navBottomLink, navDirFromPath, navPageFromPath, navKeyFromPath} = useContentHelpers()</script>
Learn more about the navigation object.
navBottomLink()
Take a navigation node and will resolve the first available path from that node.
It can be useful to build nested navigations systems.
const { navigation } = useContent()const path = navBottomLink(navigation.value)
navDirFromPath()
This function will take a path and will resolve the first available navigation node from that path.
It can be useful to find the current directory of a navigation node.
const route = useRoute()const { navigation } = useContent()const dir = navDirFromPath(route.path, navigation.value)
navPageFromPath()
This function will take a path and will resolve the first available navigation page from that path.
It can be useful to find the current navigation node the page you're browsing.
const route = useRoute()const { navigation } = useContent()const page = navPageFromPath(route.path, navigation.value)
navKeyFromPath()
This function will take a path and will resolve a specific key from that path.
It can be useful when you want to add a fallback on the _dir.yml
value of a key in a page.
const route = useRoute()const { navigation } = useContent()const layout = navKeyFromPath(route.path, 'layout', navigation.value)