Appearance
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": "/logo.svg", "nav": [ { "text": "Home", "link": "/" }, { "text": "Models", "link": "/models/" }, { "text": "Guides", "link": "/guides/" }, { "text": "Research", "link": "/research/" }, { "text": "Benchmarks", "link": "/benchmarks/" }, { "text": "Community", "link": "/community/" } ], "sidebar": { "/models/": [ { "text": "Small Language Models", "items": [ { "text": "Gemma 3", "link": "/models/gemma3" }, { "text": "Phi 4", "link": "/models/phi-4" }, { "text": "Qwen 3", "link": "/models/qwen3" } ] } ], "/guides/": [ { "text": "Getting Started", "items": [ { "text": "Use Cases", "link": "/guides/use-cases" }, { "text": "Fine-Tuning", "link": "/guides/fine-tuning" }, { "text": "Quantization", "link": "/guides/quantization" }, { "text": "Edge Deployment", "link": "/guides/edge-deployment" }, { "text": "On-Device Deployment", "link": "/guides/on-device-deployment" } ] }, { "text": "AI Agents", "items": [ { "text": "AI Agents with Small Models", "link": "/guides/ai-agents-with-small-models" } ] } ], "/research/": [ { "text": "Techniques", "items": [ { "text": "Knowledge Distillation", "link": "/research/distillation" }, { "text": "Pruning", "link": "/research/pruning" }, { "text": "Efficient Architectures", "link": "/research/architectures" } ] } ] }, "socialLinks": [], "search": { "provider": "local" }, "footer": { "message": "Released under the MIT License.", "copyright": "Copyright © 2024-present smallmodels.org" } }
Page Data
{ "title": "Runtime API Examples", "description": "", "frontmatter": { "outline": "deep" }, "headers": [], "relativePath": "api-examples.md", "filePath": "api-examples.md", "lastUpdated": 1748173121000 }
Page Frontmatter
{ "outline": "deep" }
More
Check out the documentation for the full list of runtime APIs.