Skip to content
Russell Keane
Main Navigation HomePosts

Appearance

Sidebar Navigation

2025

February (1)

Dynamically setting prev and next links in Vitepress

2019

November (1)

CloudFormation template failing to deploy

2018

March (1)

Subst'ing a drive in Windows 7 / 10

January (1)

Groovy - unable to resolve class

2017

October (2)

Reordering pages in LIFERAY forms

Spring / ZUUL - Failed to introspect annotated methods

June (1)

Sourcetree stuck on POST (chunked)

March (1)

Turning off Windows 10 ads

2016

December (1)

Failure to install / update ruby gems

July (2)

PostgreSQL - Casting integer to interval

piggly trace- invalid multibyte escape

June (1)

Jenkins stuck on "Retrieving Git references..."

March (1)

Jenkins & Groovy - accessing build parameters

2015

November (2)

Creating a Jenkins slave as a Windows service

Why Jenkins?

On this page

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": "/"
    },
    {
      "text": "Posts",
      "link": "/posts/"
    }
  ],
  "sidebar": [
    {
      "text": "2025",
      "items": [
        {
          "text": "February (1)",
          "collapsed": false,
          "items": [
            {
              "text": "Dynamically setting prev and next links in Vitepress",
              "link": "posts/2025-02-27--dynamically-setting-prev-and-next-links-in-vitepress/index.md"
            }
          ]
        }
      ]
    },
    {
      "text": "2019",
      "items": [
        {
          "text": "November (1)",
          "collapsed": false,
          "items": [
            {
              "text": "CloudFormation template failing to deploy",
              "link": "posts/2019-11-18--cloudformation-template-failing-to-deploy/index.md"
            }
          ]
        }
      ]
    },
    {
      "text": "2018",
      "items": [
        {
          "text": "March (1)",
          "collapsed": false,
          "items": [
            {
              "text": "Subst'ing a drive in Windows 7 / 10",
              "link": "posts/2018-03-01--substing-a-drive-in-windows-7-10/index.md"
            }
          ]
        },
        {
          "text": "January (1)",
          "collapsed": false,
          "items": [
            {
              "text": "Groovy - unable to resolve class",
              "link": "posts/2018-01-16--groovy-unable-to-resolve-class/index.md"
            }
          ]
        }
      ]
    },
    {
      "text": "2017",
      "items": [
        {
          "text": "October (2)",
          "collapsed": false,
          "items": [
            {
              "text": "Reordering pages in LIFERAY forms",
              "link": "posts/2017-10-23--reordering-pages-in-liferay-forms/index.md"
            },
            {
              "text": "Spring / ZUUL - Failed to introspect annotated methods",
              "link": "posts/2017-10-07--spring-zuul-failed-to-introspect-annotated-methods/index.md"
            }
          ]
        },
        {
          "text": "June (1)",
          "collapsed": false,
          "items": [
            {
              "text": "Sourcetree stuck on POST (chunked)",
              "link": "posts/2017-06-20--sourcetree-stuck-on-post-chunked/index.md"
            }
          ]
        },
        {
          "text": "March (1)",
          "collapsed": false,
          "items": [
            {
              "text": "Turning off Windows 10 ads",
              "link": "posts/2017-03-15--turning-off-windows-10-ads/index.md"
            }
          ]
        }
      ]
    },
    {
      "text": "2016",
      "items": [
        {
          "text": "December (1)",
          "collapsed": false,
          "items": [
            {
              "text": "Failure to install / update ruby gems",
              "link": "posts/2016-12-21--failure-to-install-update-ruby-gems/index.md"
            }
          ]
        },
        {
          "text": "July (2)",
          "collapsed": false,
          "items": [
            {
              "text": "PostgreSQL - Casting integer to interval",
              "link": "posts/2016-07-26--postgresql-casting-integer-to-interval/index.md"
            },
            {
              "text": "piggly trace- invalid multibyte escape",
              "link": "posts/2016-07-04--piggly-trace-invalid-multibyte-escape/index.md"
            }
          ]
        },
        {
          "text": "June (1)",
          "collapsed": false,
          "items": [
            {
              "text": "Jenkins stuck on \"Retrieving Git references...\"",
              "link": "posts/2016-06-17--jenkins-stuck-on-retrieving-git-references/index.md"
            }
          ]
        },
        {
          "text": "March (1)",
          "collapsed": false,
          "items": [
            {
              "text": "Jenkins & Groovy - accessing build parameters",
              "link": "posts/2016-03-17--jenkins-groovy-accessing-build-parameters/index.md"
            }
          ]
        }
      ]
    },
    {
      "text": "2015",
      "items": [
        {
          "text": "November (2)",
          "collapsed": false,
          "items": [
            {
              "text": "Creating a Jenkins slave as a Windows service",
              "link": "posts/2015-11-20--creating-a-jenkins-slave-as-a-windows-service/index.md"
            },
            {
              "text": "Why Jenkins?",
              "link": "posts/2015-11-19--why-jenkins/index.md"
            }
          ]
        }
      ]
    }
  ],
  "socialLinks": [
    {
      "icon": "github",
      "link": "https://github.com/Russ-K"
    }
  ],
  "footer": {
    "message": "All views expressed are my own",
    "copyright": "Copyright © 2015-present Russell Keane"
  }
}

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.

Pager
Next pageDynamically setting prev and next links in Vitepress

All views expressed are my own

Copyright © 2015-present Russell Keane