Skip to content

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

{
  "nav": [
    {
      "text": "Home",
      "link": "/home"
    },
    {
      "text": "Features",
      "link": "/features"
    },
    {
      "text": "Pricing",
      "link": "/pricing"
    },
    {
      "text": "Contact",
      "link": "/contact"
    }
  ],
  "logo": "https://genaia.app/favicon.svg",
  "sidebar": {
    "/legal/": [
      {
        "text": "Legal",
        "base": "legal/",
        "items": [
          {
            "text": "Terms of service",
            "link": "tos"
          },
          {
            "text": "Privacy Policy",
            "link": "privacy"
          }
        ]
      }
    ],
    "/features/": [
      {
        "text": "Features",
        "base": "features/",
        "items": [
          {
            "text": "Transcribe meetings",
            "link": "meeting-transcription"
          },
          {
            "text": "Capture webpages",
            "link": "capture-webpages"
          },
          {
            "text": "Chat using the best models",
            "link": "chat"
          },
          {
            "text": "Intelligent search",
            "link": "intelligent-search"
          },
          {
            "text": "Automate your inbox",
            "link": "inbox-automation"
          },
          {
            "text": "Smart data organization",
            "link": "smart-data-organization"
          }
        ]
      }
    ]
  },
  "socialLinks": [
    {
      "icon": "github",
      "link": "https://github.com/genaia"
    },
    {
      "icon": "discord",
      "link": "https://discord.gg/k2VrMfy2EE"
    },
    {
      "icon": "youtube",
      "link": "https://www.youtube.com/@genaia-app"
    },
    {
      "icon": "linkedin",
      "link": "https://www.linkedin.com/company/genaia-app"
    }
  ],
  "footer": {
    "message": "See our <a href=\"/legal/tos\">Terms of service</a> and <a href=\"/legal/privacy\">Privacy Policy</a>",
    "copyright": "Copyright &copy; 2025 by Tomaszkiewicz Enterprises. sp. z.o.o"
  },
  "search": {
    "provider": "local"
  }
}

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.