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
{
"search": {
"provider": "local"
},
"logo": "/icon/logo.svg",
"editLink": {
"pattern": "https://github.com/renuo/deploio-guides/edit/main/docs/:path",
"text": "Edit this page on GitHub"
},
"socialLinks": [
{
"icon": "facebook",
"link": "https://www.facebook.com/deploioch/"
},
{
"icon": "instagram",
"link": "https://www.instagram.com/deploio/"
},
{
"icon": "linkedin",
"link": "https://linkedin.com/company/deploio"
},
{
"icon": "x",
"link": "https://x.com/deplo_io"
}
],
"nav": [
{
"text": "Home",
"link": "/"
},
{
"text": "About",
"link": "/introduction/about-deploio"
},
{
"text": "Reference",
"link": "https://docs.nine.ch/docs/category/deploio-paas/",
"target": "_blank"
},
{
"text": "Deploio Website",
"link": "https://deplo.io",
"target": "_blank"
},
{
"text": "Pricing",
"link": "https://deplo.io/pricing",
"target": "_blank"
},
{
"text": "Login",
"link": "https://cockpit.nine.ch/en/session/new?origin=deploio",
"target": "_blank"
}
],
"outline": {
"level": [
2,
3
]
},
"sidebar": [
{
"text": "Introduction",
"collapsed": false,
"items": [
{
"text": "About Deploio",
"link": "/introduction/about-deploio"
},
{
"text": "How Deploio Works",
"link": "/introduction/how-deploio-works"
},
{
"text": "Our stack",
"link": "/introduction/our-stack"
}
]
},
{
"text": "User Guides",
"collapsed": false,
"items": [
{
"text": "Getting Started",
"link": "/user-guide/getting-started"
},
{
"text": "Code Repository Setup",
"link": "/user-guide/code-repository-setup"
},
{
"text": "Configuring Your Application",
"link": "/user-guide/configuring-your-application"
},
{
"text": "Configuring Your Database",
"link": "/user-guide/configuring-your-database"
},
{
"text": "Other dependencies",
"link": "/user-guide/other-dependencies"
},
{
"text": "Network & Deployment",
"link": "/user-guide/network-and-deployment"
},
{
"text": "CI/CD Integration",
"link": "/user-guide/ci-cd-integration"
},
{
"text": "Monitoring and Logs",
"link": "/user-guide/monitoring-and-logs"
},
{
"text": "Security",
"link": "/user-guide/security"
},
{
"text": "Troubleshooting",
"link": "/user-guide/troubleshooting"
},
{
"text": "Tools",
"link": "/user-guide/tools"
},
{
"text": "Migrating from other platforms",
"link": "/user-guide/migrating-from-other-platforms"
}
]
},
{
"text": "Ruby on Rails",
"collapsed": true,
"items": [
{
"text": "Quick start",
"link": "/ruby/quick-start"
},
{
"text": "Database",
"link": "/ruby/database"
},
{
"text": "Key/Value storage",
"link": "/ruby/key-value-storage"
},
{
"text": "Active Storage",
"link": "/ruby/active-storage"
},
{
"text": "Background jobs",
"link": "/ruby/background-jobs"
},
{
"text": "Continuous Deployment",
"link": "/ruby/continuous-deployment"
}
]
},
{
"text": "PHP",
"collapsed": true,
"items": [
{
"text": "Quick start",
"link": "/php/quick-start"
},
{
"text": "Database",
"link": "/php/database"
},
{
"text": "Key/Value storage",
"link": "/php/key-value-storage"
},
{
"text": "Object storage",
"link": "/php/object-storage"
},
{
"text": "Background jobs",
"link": "/php/background-jobs"
},
{
"text": "Continuous Deployment",
"link": "/php/continuous-deployment"
},
{
"text": "Build environment",
"link": "/php/build-environment"
},
{
"text": "Extensions",
"link": "/php/extensions"
},
{
"text": "Symfony",
"link": "/php/symfony"
}
]
},
{
"text": "Python",
"collapsed": true,
"items": [
{
"text": "Quick start",
"link": "/python/quick-start"
}
]
},
{
"text": "Go",
"collapsed": true,
"items": [
{
"text": "Quick start",
"link": "/go/quick-start"
}
]
},
{
"text": "Docker",
"collapsed": true,
"items": [
{
"text": "Quick start",
"link": "/docker/quick-start"
}
]
},
{
"text": "Node.js",
"collapsed": true,
"items": [
{
"text": "Quick start",
"link": "/nodejs/quick-start"
}
]
},
{
"text": "Static pages",
"collapsed": true,
"items": [
{
"text": "Quick start",
"link": "/static-pages/quick-start"
},
{
"text": "Static Site Generators",
"link": "/static-pages/static-site-generators"
}
]
}
]
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md"
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.