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 ​

{
  "blog": {
    "pagesData": [
      {
        "route": "/acode",
        "meta": {
          "title": "手机IDE神器 Acode ,随时随地玩转编,分享",
          "tag": [
            "分享",
            "工具"
          ],
          "date": "2026/10/25 18:43:37",
          "description": "&lt;https://pan.quark.cn/s/3bd43ad014c0\n---\nAcode 是一款完全免费的跨平台手机代码编辑器,同时也是移动端轻量化IDE,完美适配 Android 与 iO",
          "cover": ""
        }
      },
      {
        "route": "/api-examples",
        "meta": {
          "outline": "deep",
          "title": "Runtime API Examples",
          "date": "2026/10/04 19:34:15",
          "tag": [],
          "description": "This page demonstrates usage of some of the runtime APIs provided by VitePress.\nThe main `useData()`",
          "cover": ""
        }
      },
      {
        "route": "/git",
        "meta": {
          "title": "git简明教程以及资源分享",
          "tag": [
            "分享",
            "工具",
            "教程"
          ],
          "date": "2026/10/25 18:43:37",
          "description": "- git绿色版win\n- 安卓git客户端 mgit\nGit 诞生于 2005 年,最初为 Linux 内核开发打造,是一款分布式版本控制系统。它可以完整留存代码的每一次修改记录,通过分支实现并行开",
          "cover": "/git.webp"
        }
      },
      {
        "route": "/markdown-examples",
        "meta": {
          "title": "Markdown Extension Examples",
          "date": "2026/10/04 20:22:43",
          "tag": [],
          "description": "This page demonstrates some of the built-in markdown extensions provided by VitePress.\nmark\nVitePres",
          "cover": ""
        }
      },
      {
        "route": "/photoshopcs6",
        "meta": {
          "title": "Photoshop CS6 绿色精简中文版,免安装,老电脑也能飞!",
          "tag": [
            "分享",
            "工具"
          ],
          "date": "2026/10/25 18:43:37",
          "description": "第一步:解压文件到任意位置\n原版安装复杂、占满 C 盘,新版要求高配置带不动?今天给大家安排一款「宝藏版本」——Photoshop CS6 精简绿色中文版 ,免安装、无捆绑、运行丝滑,学生党、新手设计",
          "cover": "/image.png"
        }
      },
      {
        "route": "/ps_bm_course",
        "meta": {
          "title": "PS 深度系统课",
          "tag": [
            "分享",
            "工具"
          ],
          "date": "2026/10/25 18:43:37",
          "description": "​​​​​​​​​​​​​​\n你是否觉得,日常的条条框框锁住了内心的斑斓色彩?这堂 PS 深度系统课,就是你的钥匙。\n它不仅是一套涵盖核心技巧到高阶合成的视频教程,更配备了全套练习素材,助你从“熟练工",
          "cover": "/ps_course.png"
        }
      },
      {
        "route": "/quark_share",
        "meta": {
          "title": "夸克网盘 v4.5.2.516 免更新绿色版",
          "tag": [
            "分享",
            "工具"
          ],
          "date": "2026/10/25 18:43:37",
          "description": "夸克网盘 v4.5.2.516 免更新绿色版,是基于官方稳定版本优化的便携客户端,主打免安装、屏蔽自动更新,适合追求稳定纯净网盘体验的 Windows 用户。\n- 免安装:解压文件夹直接运行,不写入注",
          "cover": ""
        }
      },
      {
        "route": "/vmware17.6.3_win",
        "meta": {
          "title": "VMware Workstation使用教程",
          "date": "2026/10/04 19:34:15",
          "tag": [],
          "description": "- CPU 必须开启虚拟化:`Intel VT-x` / `AMD-V`,在主板 BIOS/UEFI 打开\n- Windows 宿主:关闭`Hyper-V`(如果开启会导致 VMware 无法启动)\n",
          "cover": ""
        }
      }
    ],
    "author": "溪云",
    "home": {
      "name": "云隙拾笺",
      "logo": "/dog.jpg",
      "avatarMode": "card"
    },
    "comment": true,
    "mermaid": false
  },
  "sidebar": [
    {
      "text": "",
      "items": []
    }
  ],
  "outlineTitle": "目录"
}

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.