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"
},
"nav": [
{
"text": "Home",
"link": "/"
},
{
"text": "Examples",
"link": "/markdown-examples"
},
{
"text": "Komputasi Awan",
"link": "/komputasi-awan/kelompok_1",
"activeMatch": "/komputasi-awan/"
},
{
"text": "Keamanan Web",
"link": "/keamanan-web/pengantar_keamanan_web",
"activeMatch": "/keamanan-web/"
},
{
"text": "Keamanan Aplikasi",
"link": "/keamanan-aplikasi/pengantar",
"activeMatch": "/keamanan-aplikasi/"
}
],
"sidebar": {
"/komputasi-awan/": {
"base": "/komputasi-awan/",
"items": [
{
"text": "Komputasi Awan",
"collapsed": false,
"items": [
{
"text": "Kelompok 1 - Introduction",
"link": "kelompok_1"
},
{
"text": "Kelompok 2 - Model Layanan",
"link": "kelompok_2"
},
{
"text": "Kelompok 3 - Model Deployment",
"link": "kelompok_3"
},
{
"text": "Kelompok 4 - Teknologi Virtualisasi",
"link": "kelompok_4"
},
{
"text": "Kelompok 5 - Manajemen Sumber Daya",
"link": "kelompok_5"
},
{
"text": "Kelompok 6 - Teknologi",
"link": "kelompok_6"
},
{
"text": "Kelompok 7 - Kasus dan Aplikasi",
"link": "kelompok_7"
}
]
}
]
},
"/keamanan-web/": {
"base": "/keamanan-web/",
"items": [
{
"text": "Keamanan Web",
"collapsed": false,
"items": [
{
"text": "Pengantar Keamanan Web",
"link": "pengantar_keamanan_web"
},
{
"text": "Arsitektur Web Browser",
"link": "arsitektur_web_browser"
},
{
"text": "HTTP Protocol",
"link": "http"
},
{
"text": "HTTP Status Code",
"link": "http_status_code"
},
{
"text": "DNS (Domain Name System)",
"link": "dns"
},
{
"text": "Footprinting",
"link": "footprinting"
},
{
"text": "Port Scanning",
"link": "port_scanning"
},
{
"text": "Google Dorking",
"link": "google_dorking"
},
{
"text": "Cross-Site Scripting (XSS)",
"link": "xss"
}
]
}
]
},
"/keamanan-aplikasi/": {
"base": "/keamanan-aplikasi/",
"items": [
{
"text": "Keamanan Aplikasi",
"collapsed": false,
"items": [
{
"text": "Pengantar Keamanan Aplikasi",
"link": "pengantar"
},
{
"text": "Arsitektur Keamanan Aplikasi",
"link": "arsitektur_keamanan_aplikasi"
},
{
"text": "OWASP Top 10",
"link": "owasp_top_10"
},
{
"text": "Android Project Files",
"link": "android_project_files"
},
{
"text": "Android Static Analysis",
"link": "android_static_analysis"
},
{
"text": "Testing Penetrasi",
"link": "penetrasi"
}
]
}
]
}
},
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/vuejs/vitepress"
}
]
}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.