Appearance
API Examples
Runtime API Examples
This page demonstrates usage of some of the runtime APIs provided by VitePress.
The main useData() API can be used to access site-level metadata:
javascript
import { useData } from 'vitepress'
export default {
setup() {
const { theme, page, frontmatter } = useData()
// theme.value -> themeConfig object from config.js
// page.value -> metadata of current page
// frontmatter.value -> frontmatter data of current page
}
}More
Check out the documentation to learn more about the Related Plugins.