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": {
"light": "/infive_logo_black_full.svg",
"dark": "/infive_logo_white_full.svg"
},
"siteTitle": false,
"nav": [
{
"text": "Hilfe & Support",
"link": "/"
},
{
"text": "Ich brauche keine Hilfe mehr",
"link": "https://infive.app"
}
],
"outline": {
"label": "Auf dieser Seite"
},
"externalLinkIcon": true,
"docFooter": {
"prev": "Vorherige Seite",
"next": "Nächste Seite"
},
"lightModeSwitchTitle": "Helle Ansicht",
"darkModeSwitchTitle": "Dunkle Ansicht",
"sidebarMenuLabel": "Menü",
"returnToTopLabel": "Zurück nach oben",
"sidebar": {
"/employees/": {
"base": "/employees/",
"items": [
{
"text": "Introduction",
"collapsed": false,
"items": [
{
"text": "What is VitePress?",
"link": "what-is-vitepress"
},
{
"text": "Getting Started",
"link": "getting-started"
},
{
"text": "Routing",
"link": "routing"
},
{
"text": "Deploy",
"link": "deploy"
}
]
}
]
},
"/companies/": {
"base": "/companies/",
"items": [
{
"text": "Reference",
"items": [
{
"text": "Site Config",
"link": "site-config"
}
]
}
]
},
"/info/": {
"base": "/info/",
"items": [
{
"text": "Gesundheitsförderung",
"collapsed": false,
"items": [
{
"text": "Was ist Betriebliche Gesundheitsförderung?",
"link": "whp/what-is-whp"
},
{
"text": "Vorteile für Unternehmen und Mitarbeiter",
"link": "whp/benefits-for-companies-and-employees"
},
{
"text": "Pausensport als Teil der Gesundheitsförderung",
"link": "whp/break-time-sports-as-part-of-health-promotion"
},
{
"text": "InFive",
"base": "/info/whp/infive-",
"items": [
{
"text": "Mikropausen",
"link": "micro-breaks"
},
{
"text": "Übungen",
"link": "exercises"
},
{
"text": "Erfolgsmessung und Feedbackmechanismen",
"link": "performance-measurement-and-feedback-mechanisms"
},
{
"text": "Expertenmeinungen",
"link": "expert-opinions"
}
]
},
{
"text": "Wissenschaftliche Grundlagen und Studien",
"link": "whp/scientific-basis-and-studies"
}
]
},
{
"text": "Schmerzbehandlung",
"collapsed": false,
"items": [
{
"text": "Häufige Schmerzen bei Büroangestellten",
"link": "pain-treatment/frequent-pain-among-office-workers"
},
{
"text": "Auswirkungen unbehandelter Schmerzen",
"link": "branding"
},
{
"text": "InFive",
"base": "/reference/default-theme-",
"items": [
{
"text": "Sofort wirksame Übungen für akute Beschwerden",
"link": "config"
},
{
"text": "Vermittlung von Wissen",
"link": "nav"
},
{
"text": "Vorbeugung von Schmerzen",
"link": "home-page"
},
{
"text": "Expertenmeinungen",
"link": "home-page"
}
]
}
]
},
{
"text": "Unternehmen",
"collapsed": true,
"items": [
{
"text": "Über uns",
"link": "company/about-us"
},
{
"text": "Branding",
"link": "company/branding"
},
{
"text": "Kontakt",
"link": "company/contact"
}
]
},
{
"text": "Sicherheit",
"collapsed": true,
"items": [
{
"text": "Server",
"link": "security/servers"
}
]
},
{
"text": "Rechtliches",
"collapsed": true,
"items": [
{
"text": "Impressum",
"link": "legal/imprint"
},
{
"text": "Datenschutzbestimmungen",
"link": "legal/privacy-policy"
}
]
}
]
}
}
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "companies/api-examples.md",
"filePath": "companies/api-examples.md"
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.