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": {
"src": "/physicsfoundations-org-logo-mini.png",
"width": 24,
"height": 24
},
"siteTitle": "Physics Foundations Soc.",
"nav": [
{
"text": "Home",
"link": "/"
},
{
"text": "Members",
"link": "/suntola/"
},
{
"text": "Dynamic Universe",
"link": "/suntola/dynamic-universe"
},
{
"text": "Period Doubling",
"link": "/lehto/period-doubling"
},
{
"text": "Guide",
"link": "/guide/what-is-physics-foundations",
"activeMatch": "/guide/"
},
{
"text": "Reference",
"link": "/reference/dynamic-universe",
"activeMatch": "/reference/"
}
],
"sidebar": {
"/guide/": {
"base": "/guide/",
"items": [
{
"text": "Examples",
"items": [
{
"text": "Markdown Examples",
"link": "/markdown-examples"
},
{
"text": "Runtime API Examples",
"link": "/api-examples"
}
]
},
{
"text": "Introduction",
"collapsed": false,
"items": [
{
"text": "What is Physics Foundations Society?",
"link": "what-is-physics-foundations"
}
]
},
{
"text": "Writing",
"collapsed": false,
"items": [
{
"text": "Markdown Extensions",
"link": "markdown"
}
]
},
{
"text": "Customization",
"collapsed": false,
"items": [
{
"text": "Using a Custom Theme",
"link": "custom-theme"
}
]
},
{
"text": "Experimental",
"collapsed": false,
"items": [
{
"text": "MPA Mode",
"link": "mpa-mode"
}
]
},
{
"text": "Config & API Reference",
"base": "/reference/",
"link": "site-config"
}
]
},
"/reference/": {
"base": "/reference/",
"items": [
{
"text": "Reference",
"items": [
{
"text": "Site Config",
"link": "site-config"
},
{
"text": "Default Theme",
"base": "/reference/default-theme-",
"items": [
{
"text": "Overview",
"link": "config"
},
{
"text": "Nav",
"link": "nav"
}
]
}
]
}
]
},
"/suntola/": {
"base": "",
"items": [
{
"text": "Members",
"collapsed": false,
"items": [
{
"text": "Tuomo Suntola",
"link": "/suntola/",
"items": [
{
"text": "Atomic Layer Deposition",
"link": "/suntola/atomic-layer-deposition"
},
{
"text": "Renewable Energy",
"link": "/suntola/renewable-energy"
},
{
"text": "Dynamic Universe",
"link": "/suntola/dynamic-universe"
}
]
},
{
"text": "Ari Lehto",
"link": "/lehto/",
"items": [
{
"text": "Period Doubling",
"link": "/lehto/period-doubling"
}
]
},
{
"text": "Heikki Sipilä",
"link": "/sipilä/",
"items": [
{
"text": "Zero-Energy Principle",
"link": "/sipilä/zero-energy-principle"
}
]
},
{
"text": "Tarja Kallio-Tamminen",
"link": "/kallio-tamminen/"
},
{
"text": "Avril Styrman",
"link": "/styrman"
},
{
"text": "Petri Lievonen",
"link": "/lievonen/"
},
{
"text": "More members and collaborators",
"link": "/more-members-and-collaborators"
}
]
}
]
},
"/lehto/": {
"base": "",
"items": [
{
"text": "Members",
"collapsed": false,
"items": [
{
"text": "Tuomo Suntola",
"link": "/suntola/",
"items": [
{
"text": "Atomic Layer Deposition",
"link": "/suntola/atomic-layer-deposition"
},
{
"text": "Renewable Energy",
"link": "/suntola/renewable-energy"
},
{
"text": "Dynamic Universe",
"link": "/suntola/dynamic-universe"
}
]
},
{
"text": "Ari Lehto",
"link": "/lehto/",
"items": [
{
"text": "Period Doubling",
"link": "/lehto/period-doubling"
}
]
},
{
"text": "Heikki Sipilä",
"link": "/sipilä/",
"items": [
{
"text": "Zero-Energy Principle",
"link": "/sipilä/zero-energy-principle"
}
]
},
{
"text": "Tarja Kallio-Tamminen",
"link": "/kallio-tamminen/"
},
{
"text": "Avril Styrman",
"link": "/styrman"
},
{
"text": "Petri Lievonen",
"link": "/lievonen/"
},
{
"text": "More members and collaborators",
"link": "/more-members-and-collaborators"
}
]
}
]
},
"/sipilä/": {
"base": "",
"items": [
{
"text": "Members",
"collapsed": false,
"items": [
{
"text": "Tuomo Suntola",
"link": "/suntola/",
"items": [
{
"text": "Atomic Layer Deposition",
"link": "/suntola/atomic-layer-deposition"
},
{
"text": "Renewable Energy",
"link": "/suntola/renewable-energy"
},
{
"text": "Dynamic Universe",
"link": "/suntola/dynamic-universe"
}
]
},
{
"text": "Ari Lehto",
"link": "/lehto/",
"items": [
{
"text": "Period Doubling",
"link": "/lehto/period-doubling"
}
]
},
{
"text": "Heikki Sipilä",
"link": "/sipilä/",
"items": [
{
"text": "Zero-Energy Principle",
"link": "/sipilä/zero-energy-principle"
}
]
},
{
"text": "Tarja Kallio-Tamminen",
"link": "/kallio-tamminen/"
},
{
"text": "Avril Styrman",
"link": "/styrman"
},
{
"text": "Petri Lievonen",
"link": "/lievonen/"
},
{
"text": "More members and collaborators",
"link": "/more-members-and-collaborators"
}
]
}
]
},
"/kallio-tamminen/": {
"base": "",
"items": [
{
"text": "Members",
"collapsed": false,
"items": [
{
"text": "Tuomo Suntola",
"link": "/suntola/",
"items": [
{
"text": "Atomic Layer Deposition",
"link": "/suntola/atomic-layer-deposition"
},
{
"text": "Renewable Energy",
"link": "/suntola/renewable-energy"
},
{
"text": "Dynamic Universe",
"link": "/suntola/dynamic-universe"
}
]
},
{
"text": "Ari Lehto",
"link": "/lehto/",
"items": [
{
"text": "Period Doubling",
"link": "/lehto/period-doubling"
}
]
},
{
"text": "Heikki Sipilä",
"link": "/sipilä/",
"items": [
{
"text": "Zero-Energy Principle",
"link": "/sipilä/zero-energy-principle"
}
]
},
{
"text": "Tarja Kallio-Tamminen",
"link": "/kallio-tamminen/"
},
{
"text": "Avril Styrman",
"link": "/styrman"
},
{
"text": "Petri Lievonen",
"link": "/lievonen/"
},
{
"text": "More members and collaborators",
"link": "/more-members-and-collaborators"
}
]
}
]
},
"/styrman": {
"base": "",
"items": [
{
"text": "Members",
"collapsed": false,
"items": [
{
"text": "Tuomo Suntola",
"link": "/suntola/",
"items": [
{
"text": "Atomic Layer Deposition",
"link": "/suntola/atomic-layer-deposition"
},
{
"text": "Renewable Energy",
"link": "/suntola/renewable-energy"
},
{
"text": "Dynamic Universe",
"link": "/suntola/dynamic-universe"
}
]
},
{
"text": "Ari Lehto",
"link": "/lehto/",
"items": [
{
"text": "Period Doubling",
"link": "/lehto/period-doubling"
}
]
},
{
"text": "Heikki Sipilä",
"link": "/sipilä/",
"items": [
{
"text": "Zero-Energy Principle",
"link": "/sipilä/zero-energy-principle"
}
]
},
{
"text": "Tarja Kallio-Tamminen",
"link": "/kallio-tamminen/"
},
{
"text": "Avril Styrman",
"link": "/styrman"
},
{
"text": "Petri Lievonen",
"link": "/lievonen/"
},
{
"text": "More members and collaborators",
"link": "/more-members-and-collaborators"
}
]
}
]
},
"/lievonen/": {
"base": "",
"items": [
{
"text": "Members",
"collapsed": false,
"items": [
{
"text": "Tuomo Suntola",
"link": "/suntola/",
"items": [
{
"text": "Atomic Layer Deposition",
"link": "/suntola/atomic-layer-deposition"
},
{
"text": "Renewable Energy",
"link": "/suntola/renewable-energy"
},
{
"text": "Dynamic Universe",
"link": "/suntola/dynamic-universe"
}
]
},
{
"text": "Ari Lehto",
"link": "/lehto/",
"items": [
{
"text": "Period Doubling",
"link": "/lehto/period-doubling"
}
]
},
{
"text": "Heikki Sipilä",
"link": "/sipilä/",
"items": [
{
"text": "Zero-Energy Principle",
"link": "/sipilä/zero-energy-principle"
}
]
},
{
"text": "Tarja Kallio-Tamminen",
"link": "/kallio-tamminen/"
},
{
"text": "Avril Styrman",
"link": "/styrman"
},
{
"text": "Petri Lievonen",
"link": "/lievonen/"
},
{
"text": "More members and collaborators",
"link": "/more-members-and-collaborators"
}
]
}
]
},
"/more-members-and-collaborators": {
"base": "",
"items": [
{
"text": "Members",
"collapsed": false,
"items": [
{
"text": "Tuomo Suntola",
"link": "/suntola/",
"items": [
{
"text": "Atomic Layer Deposition",
"link": "/suntola/atomic-layer-deposition"
},
{
"text": "Renewable Energy",
"link": "/suntola/renewable-energy"
},
{
"text": "Dynamic Universe",
"link": "/suntola/dynamic-universe"
}
]
},
{
"text": "Ari Lehto",
"link": "/lehto/",
"items": [
{
"text": "Period Doubling",
"link": "/lehto/period-doubling"
}
]
},
{
"text": "Heikki Sipilä",
"link": "/sipilä/",
"items": [
{
"text": "Zero-Energy Principle",
"link": "/sipilä/zero-energy-principle"
}
]
},
{
"text": "Tarja Kallio-Tamminen",
"link": "/kallio-tamminen/"
},
{
"text": "Avril Styrman",
"link": "/styrman"
},
{
"text": "Petri Lievonen",
"link": "/lievonen/"
},
{
"text": "More members and collaborators",
"link": "/more-members-and-collaborators"
}
]
}
]
}
},
"footer": {
"copyright": "Copyright © 2024–present Physics Foundations Society ry. ID 3066327-8"
}
}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.