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>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Results
Theme Data
{
"outline": [
1,
3
],
"editLink": {
"pattern": "https://github.com/Premium-WordPress/tudasbazis.surbma.hu/edit/main/docs/:path",
"text": "Oldal szerkesztése a GitHub-on"
},
"lastUpdated": {
"text": "Utoljára frissítve",
"formatOptions": {
"dateStyle": "full",
"timeStyle": "medium"
}
},
"docFooter": {
"prev": "Előző oldal",
"next": "Következő oldal"
},
"returnToTopLabel": "Ugrás a tetejére",
"skipToContentLabel": "Ugrás a tartalomra",
"externalLinkIcon": true,
"nav": [
{
"text": "Surbma",
"link": "/surbma/",
"activeMatch": "/surbma/"
},
{
"text": "Prémium WordPress",
"activeMatch": "/pwp/",
"items": [
{
"text": "Folyamat leírások",
"link": "/pwp/folyamat-leirasok/"
},
{
"text": "Karbantartás & Üzemeltetés",
"link": "/pwp/karbantartas-es-uzemeltetes/"
},
{
"text": "Csomagok, szolgáltatások",
"link": "/pwp/csomagok-szolgaltatasok/"
}
]
},
{
"text": "HuCommerce",
"link": "/hucommerce/",
"activeMatch": "/hucommerce/"
},
{
"text": "CPS",
"link": "/cps/",
"activeMatch": "/cps/"
},
{
"text": "Snippets",
"link": "/snippets/",
"activeMatch": "/snippets/"
}
],
"sidebar": {
"/surbma/": {
"base": "/surbma/",
"items": [
{
"text": "Examples",
"collapsed": false,
"items": [
{
"text": "Markdown Examples",
"link": "markdown-examples"
},
{
"text": "Runtime API Examples",
"link": "api-examples"
}
]
},
{
"text": "Reference",
"collapsed": false,
"items": [
{
"text": "Site Config",
"link": "site-config"
},
{
"text": "Frontmatter Config",
"link": "frontmatter-config"
},
{
"text": "Runtime API",
"link": "runtime-api"
},
{
"text": "CLI",
"link": "cli"
},
{
"text": "Default Theme",
"base": "/reference/default-theme-",
"items": [
{
"text": "Overview",
"link": "config"
},
{
"text": "Nav",
"link": "nav"
},
{
"text": "Sidebar",
"link": "sidebar"
},
{
"text": "Home Page",
"link": "home-page"
},
{
"text": "Footer",
"link": "footer"
},
{
"text": "Layout",
"link": "layout"
},
{
"text": "Badge",
"link": "badge"
},
{
"text": "Team Page",
"link": "team-page"
},
{
"text": "Prev / Next Links",
"link": "prev-next-links"
},
{
"text": "Edit Link",
"link": "edit-link"
},
{
"text": "Last Updated Timestamp",
"link": "last-updated"
},
{
"text": "Search",
"link": "search"
},
{
"text": "Carbon Ads",
"link": "carbon-ads"
}
]
}
]
}
]
},
"/pwp/": {
"base": "/pwp/",
"items": [
{
"text": "📚 Tudásbázis kategóriák",
"items": [
{
"text": "Folyamat leírások",
"link": "/folyamat-leirasok/"
},
{
"text": "Folyamat leírások",
"link": "/folyamat-leirasok/"
},
{
"text": "Folyamat leírások",
"link": "/folyamat-leirasok/"
}
]
}
]
},
"/pwp/folyamat-leirasok/": {
"base": "/pwp/folyamat-leirasok/",
"items": [
{
"text": "📚 Tudásbázis kategóriák",
"collapsed": true,
"items": [
{
"text": "Folyamat leírások",
"link": "../folyamat-leirasok/"
},
{
"text": "Folyamat leírások",
"link": "../folyamat-leirasok/"
},
{
"text": "Folyamat leírások",
"link": "../folyamat-leirasok/"
}
]
},
{
"text": "Importált, rendezetlen",
"collapsed": false,
"items": [
{
"text": "Folyamat leírások",
"link": "folyamat-leirasok"
}
]
},
{
"text": "Writing",
"collapsed": false,
"items": [
{
"text": "Markdown Extensions",
"link": "markdown"
},
{
"text": "Asset Handling",
"link": "asset-handling"
},
{
"text": "Frontmatter",
"link": "frontmatter"
},
{
"text": "Using Vue in Markdown",
"link": "using-vue"
},
{
"text": "Internationalization",
"link": "i18n"
}
]
},
{
"text": "Customization",
"collapsed": false,
"items": [
{
"text": "Using a Custom Theme",
"link": "custom-theme"
},
{
"text": "Extending the Default Theme",
"link": "extending-default-theme"
},
{
"text": "Build-Time Data Loading",
"link": "data-loading"
},
{
"text": "SSR Compatibility",
"link": "ssr-compat"
},
{
"text": "Connecting to a CMS",
"link": "cms"
}
]
},
{
"text": "Experimental",
"collapsed": false,
"items": [
{
"text": "MPA Mode",
"link": "mpa-mode"
},
{
"text": "Sitemap Generation",
"link": "sitemap-generation"
}
]
},
{
"text": "Config & API Reference",
"base": "/reference/",
"link": "site-config"
}
]
}
},
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/Premium-WordPress/tudasbazis.surbma.hu"
},
{
"icon": "vitepress",
"link": "https://vitepress.dev"
}
],
"search": {
"provider": "local",
"options": {
"translations": {
"button": {
"buttonText": "Keresés",
"buttonAriaLabel": "Keresés a dokumentációban"
},
"modal": {
"displayDetails": "Részletek megjelenítése",
"resetButtonTitle": "Keresés törlése",
"backButtonTitle": "Vissza",
"noResultsText": "Nincs találat erre:",
"footer": {
"selectText": "Választ",
"selectKeyAriaLabel": "Keresés a kiválasztottra",
"navigateText": "Navigálás",
"navigateUpKeyAriaLabel": "Navigálás felfelé",
"navigateDownKeyAriaLabel": "Navigálás lefelé",
"closeText": "Bezár",
"closeKeyAriaLabel": "Kereső bezárása"
}
}
}
}
},
"footer": {
"message": "Sok tapasztalattal 👨💻, munkával 💪 és törődéssel ❤️ készítettük.",
"copyright": "Copyright © Prémium WordPress"
}
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {},
"headers": [],
"relativePath": "surbma/api-examples.md",
"filePath": "surbma/api-examples.md",
"lastUpdated": 1761824586000
}Page Frontmatter
{}More
Check out the documentation for the full list of runtime APIs.