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:
race hover example
Takarazuka Kinen (G1)Nikkei Shinshun Hai (G2)Kyoto Kimpai (G3)Manyo Stakes (OP)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": "/icon/umaguide_logo.svg",
"nav": [
{
"text": "Home",
"link": "/"
}
],
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/sayaduck/umaguide"
}
],
"search": {
"provider": "local",
"options": {
"disableDetailedView": false,
"detailedView": true,
"miniSearch": {
"searchOptions": {
"combineWith": "AND",
"fuzzy": 0.2,
"maxFuzzy": 4
}
}
}
}
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"title": "Runtime API Examples",
"head": [
[
"link",
{
"rel": "canonical",
"href": "https://uma.guide/api-examples/"
}
],
[
"meta",
{
"property": "og:title",
"content": "Runtime API Examples | uma.guide"
}
],
[
"meta",
{
"property": "og:description",
"content": "Comprehensive guides, references, and tools for Umamusume: Pretty Derby trainers."
}
],
[
"meta",
{
"property": "og:url",
"content": "https://uma.guide/api-examples/"
}
],
[
"meta",
{
"name": "twitter:title",
"content": "Runtime API Examples | uma.guide"
}
],
[
"meta",
{
"name": "twitter:description",
"content": "Comprehensive guides, references, and tools for Umamusume: Pretty Derby trainers."
}
]
]
},
"headers": [],
"relativePath": "api-examples/index.md",
"filePath": "api-examples/index.md",
"lastUpdated": 1773651452000
}Page Frontmatter
{
"title": "Runtime API Examples",
"head": [
[
"link",
{
"rel": "canonical",
"href": "https://uma.guide/api-examples/"
}
],
[
"meta",
{
"property": "og:title",
"content": "Runtime API Examples | uma.guide"
}
],
[
"meta",
{
"property": "og:description",
"content": "Comprehensive guides, references, and tools for Umamusume: Pretty Derby trainers."
}
],
[
"meta",
{
"property": "og:url",
"content": "https://uma.guide/api-examples/"
}
],
[
"meta",
{
"name": "twitter:title",
"content": "Runtime API Examples | uma.guide"
}
],
[
"meta",
{
"name": "twitter:description",
"content": "Comprehensive guides, references, and tools for Umamusume: Pretty Derby trainers."
}
]
]
}More
Check out the documentation for the full list of runtime APIs.