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": "/icon-smol.png",
"outline": {
"level": [
2,
6
]
},
"editLink": {
"pattern": "https://github.com/molbal/cozyui-docs/blob/main/:path",
"text": "Edit this page on GitHub"
},
"lastUpdated": true,
"cleanUrls": true,
"externalLinkIcon": true,
"nav": [
{
"text": "Home",
"link": "/"
},
{
"text": "Getting Started",
"link": "/getting-started/installation"
},
{
"text": "Developer Guide",
"link": "/developers/dev-index"
},
{
"text": "Troubleshooting",
"link": "/troubleshooting/t-index"
}
],
"sidebar": [
{
"text": "Getting Started",
"items": [
{
"text": "Installation",
"link": "/getting-started/installation"
},
{
"text": "Running",
"link": "/getting-started/running"
},
{
"text": "Concepts",
"link": "/getting-started/concepts"
},
{
"text": "Workflows (Agents)",
"link": "/getting-started/workflows"
},
{
"text": "Node Execution Order",
"link": "/getting-started/execution-order"
},
{
"text": "Configuration",
"link": "/getting-started/configuration"
},
{
"text": "Deployment for scale",
"link": "/getting-started/deployment"
},
{
"text": "Workflow Analytics",
"link": "/getting-started/observability"
}
]
},
{
"text": "Integrating CozyUI",
"items": [
{
"text": "Model Context Protocol (MCP)",
"link": "/integration/mcp"
},
{
"text": "OpenAI API",
"link": "/integration/openai-api"
},
{
"text": "Triggers",
"link": "/integration/triggers"
},
{
"text": "Secret storage",
"link": "/integration/secrets"
},
{
"text": "Observability in CozyUI",
"link": "/integration/observability"
}
]
},
{
"text": "Best Practices",
"items": [
{
"text": "Design patterns",
"link": "/best-practices/design-patters"
},
{
"text": "Prompt Chaining",
"link": "/best-practices/prompt-chaining"
},
{
"text": "Prompt Routing",
"link": "/best-practices/prompt-routing"
},
{
"text": "Prompt Orchestration",
"link": "/best-practices/prompt-orchestration"
},
{
"text": "Evaluation-optimizer",
"link": "/best-practices/evaluator-optimizer"
},
{
"text": "Agentic Workflows",
"link": "/best-practices/agentic-workflows"
}
]
},
{
"text": "Real life examples",
"items": [
{
"text": "Deep research",
"link": "/examples/deep-research"
},
{
"text": "Mass image captioning",
"link": "/examples/image-captioning"
}
]
},
{
"text": "CozyUI Hub",
"items": [
{
"text": "Community Portal",
"link": "/community/ch-index"
},
{
"text": "Sharing workflows",
"link": "/community/workflows"
},
{
"text": "Community nodes",
"link": "/community/nodes"
},
{
"text": "Community support",
"link": "/community/support"
}
]
},
{
"text": "Developer Guide",
"items": [
{
"text": "Starting Point",
"link": "/developers/dev-index"
},
{
"text": "Core Concepts",
"link": "/developers/core-concepts"
},
{
"text": "Execution order",
"link": "/developers/execution-order"
},
{
"text": "Architecture of a node",
"link": "/developers/node"
},
{
"text": "Available helpers",
"link": "/developers/helpers"
},
{
"text": "Triggering leaves",
"link": "/developers/triggering-leaves"
},
{
"text": "Frontend events",
"link": "/developers/events"
},
{
"text": "Publishing nodes",
"link": "/developers/publishing-nodes"
}
]
},
{
"text": "Support",
"link": "/general/support"
},
{
"text": "Licensing",
"link": "/general/license"
}
],
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/molbal/cozyui"
},
{
"icon": "reddit",
"link": "https://reddit.com/r/cozyui"
},
{
"icon": "discord",
"link": "https://discord.gg/SwxRjf5x2r"
}
],
"search": {
"provider": "local"
},
"footer": {
"message": "Free and open source software released under the Apache License 2.0.",
"copyright": "Copyright © 2025 <a href=\"https://www.linkedin.com/in/balint-molnar/\" target=\"_blank\">Bálint Molnár-Kaló</a"
}
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md",
"lastUpdated": 1755541989000
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.