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, theme, and page data for the current page. It works in both .md and .vue files:
md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>Results
Theme Data
{
"logo": "/assets/icon.png",
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/FoxyStar-Studios"
},
{
"icon": "discord",
"link": "https://discord.gg/better-on-bedrock"
}
],
"editLink": {
"pattern": "https://github.com/FoxyStar-Studios/wiki/edit/main/:path",
"text": "Suggest changes to this page"
},
"search": {
"provider": "local"
},
"nav": [
{
"text": "Home",
"link": "/"
},
{
"text": "Content",
"items": [
{
"component": "NavbarItem",
"props": {
"imageSrc": "/better-on-bedrock/assets/title.png",
"text": "Better on Bedrock",
"link": "/better-on-bedrock"
}
}
]
}
],
"sidebar": {
"/better-on-bedrock": [
{
"text": "Better on Bedrock",
"items": []
}
],
"/better-on-bedrock/changelogs": [
{
"text": "Changelogs",
"items": [
{
"items": [
{
"text": "Better on Bedrock — 1.1.4",
"link": "/better-on-bedrock/changelogs/1.1.4"
}
]
}
]
}
]
},
"externalLinkIcon": true,
"lastUpdated": {
"text": "Updated at",
"formatOptions": {
"dateStyle": "full",
"timeStyle": "medium"
}
},
"footer": {
"message": "",
"copyright": "Copyright © 2025-present FoxyStar Studios™"
}
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep",
"head": [
[
"meta",
{
"property": "og:url",
"content": "https://wiki.foxystar.net/api-examples"
}
],
[
"link",
{
"rel": "shortcut icon",
"type": "image/png",
"href": "https://wiki.foxystar.net/assets/icon-empty.png"
}
],
[
"meta",
{
"property": "og:image",
"content": "https://wiki.foxystar.net/assets/icon.png"
}
],
[
"meta",
{
"property": "twitter:image",
"content": "https://wiki.foxystar.net/assets/icon.png"
}
]
]
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md",
"lastUpdated": 1757711549000
}Page Frontmatter
{
"outline": "deep",
"head": [
[
"meta",
{
"property": "og:url",
"content": "https://wiki.foxystar.net/api-examples"
}
],
[
"link",
{
"rel": "shortcut icon",
"type": "image/png",
"href": "https://wiki.foxystar.net/assets/icon-empty.png"
}
],
[
"meta",
{
"property": "og:image",
"content": "https://wiki.foxystar.net/assets/icon.png"
}
],
[
"meta",
{
"property": "twitter:image",
"content": "https://wiki.foxystar.net/assets/icon.png"
}
]
]
}More
Check out the documentation for the full list of runtime APIs.