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": "/fvdocs.png",
"nav": [
{
"text": "Home",
"link": "/"
},
{
"text": "Guide",
"link": "/guide",
"activeMatch": "/guide/"
},
{
"text": "Lilly",
"link": "/lilly",
"activeMatch": "/lilly/"
},
{
"text": "Tecnimede",
"link": "/tecnimede",
"activeMatch": "/tecnimede/"
},
{
"text": "Alfasigma",
"link": "/alfasigma",
"activeMatch": "/alfasigma/"
},
{
"text": "IQVia",
"link": "/iqvia",
"activeMatch": "/iqvia/"
},
{
"text": "VitePress Tips",
"link": "/presstips/notes",
"activeMatch": "/presstips"
}
],
"sidebar": {
"/guide/": [
{
"text": "Guide",
"items": [
{
"text": "Introduction",
"link": "/guide/"
},
{
"text": "Email Vault",
"link": "/guide/email-vault"
},
{
"text": "Veeva Vault Bugs",
"link": "/guide/veeva-bugs"
},
{
"text": "iDetail functions reference",
"link": "/guide/id-functions"
},
{
"text": "iDetail Veeva Vault",
"link": "/guide/id-veeva"
},
{
"text": "Aliança Lilly - Boheringer snippets",
"link": "/guide/lilly-alianca"
},
{
"text": "Lundbeck Emails",
"link": "/guide/lundbeck-emails"
},
{
"text": "Tecnimede Emails",
"link": "/guide/tecnimede-emails"
},
{
"text": "Glossary",
"link": "/guide/glossary"
}
]
}
],
"/lilly/": [
{
"text": "Lilly Guide",
"items": [
{
"text": "RTEs for Lilly",
"link": "/lilly/"
},
{
"text": "Submission Process",
"link": "/lilly/submission-process"
},
{
"text": "Salutations and Signatures for Lilly",
"link": "/lilly/rte-vars"
},
{
"text": "Email Template and Fragments",
"link": "/lilly/email-frags"
},
{
"text": "Updating Existing Approved Pieces",
"link": "/lilly/update-aproved-pieces"
},
{
"text": "SalesForce Marketing Cloud",
"link": "/lilly/marketing-cloud"
},
{
"text": "Lilly Play Links",
"link": "/lilly/lilly-play-links"
},
{
"text": "Lilly Footers",
"link": "/lilly/footers"
},
{
"text": "RCMs Medicamentos Lilly",
"link": "/lilly/rcms-lilly"
}
]
}
],
"/tecnimede/": [
{
"text": "Tecnimede Guide",
"items": [
{
"text": "Footers",
"link": "/tecnimede/footers"
},
{
"text": "Templates",
"link": "/tecnimede/templates"
}
]
}
],
"/alfasigma/": [
{
"text": "Alfasigma Guide"
}
],
"/iqvia/": [
{
"text": "IQVia Guide",
"items": [
{
"text": "Introduction",
"link": "/iqvia/"
},
{
"text": "iDetails",
"link": "/iqvia/idetails"
},
{
"text": "Emails",
"link": "/iqvia/emails"
}
]
}
],
"/": [
{
"text": "VitePress Tips",
"items": [
{
"text": "Markdown Examples",
"link": "/presstips/notes"
},
{
"text": "Runtime API Examples",
"link": "/presstips/api-examples"
}
]
}
]
},
"editLink": {
"pattern": "https://gitfloat.pt/float-internal/fvdocs2/edit/master/:path",
"text": "Edit this page"
},
"search": {
"provider": "local"
},
"lastUpdated": true,
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/vuejs/vitepress"
}
],
"footer": {
"copyright": "Made by Miguel Santos with ❤️"
}
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "presstips/api-examples.md",
"filePath": "presstips/api-examples.md",
"lastUpdated": 1724793075000
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.
