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

{
  "search": {
    "provider": "local"
  },
  "outlineTitle": "En esta página",
  "nav": [
    {
      "text": "Home",
      "link": "/"
    },
    {
      "text": "Documentación",
      "link": "/bienvenida/"
    }
  ],
  "sidebar": [
    {
      "text": "Introducción",
      "items": [
        {
          "text": "Bienvenida",
          "link": "/bienvenida"
        },
        {
          "text": "Guía de uso",
          "link": "/guia"
        }
      ]
    },
    {
      "text": "Botservices",
      "collapsed": false,
      "items": [
        {
          "text": "Descripción general",
          "link": "/botservices/"
        },
        {
          "text": "Atención y Soporte",
          "collapsed": false,
          "items": [
            {
              "text": "maxv2-route",
              "link": "/botservices/atencion-y-soporte/max-v2-route"
            },
            {
              "text": "whatsapp-v1-getbyphone",
              "link": "/botservices/atencion-y-soporte/whatsapp-v1-getbyphone"
            }
          ]
        },
        {
          "text": "Gestión de Clientes",
          "collapsed": false,
          "items": [
            {
              "text": "customers-v1-settyc",
              "link": "/botservices/gestion-de-clientes/customers-v1-settyc"
            },
            {
              "text": "customers-v1-enrollvalidationcode",
              "link": "/botservices/gestion-de-clientes/customers-v1-enrollvalidationcode"
            }
          ]
        },
        {
          "text": "Gestión de Ordenes",
          "collapsed": false,
          "items": [
            {
              "text": "orders-v4-get",
              "link": "/botservices/gestion-de-ordenes/orders-v4-get"
            }
          ]
        }
      ]
    },
    {
      "text": "Mulesoft",
      "collapsed": false,
      "items": [
        {
          "text": "Descripción general",
          "link": "/mulesoft/"
        },
        {
          "text": "bot-xapi-services",
          "collapsed": false,
          "items": [
            {
              "text": "Descripción general",
              "link": "/mulesoft/bot-xapi-services/"
            },
            {
              "text": "parameters businessdays v1",
              "link": "/mulesoft/bot-xapi-services/v1/parameters-businessdays"
            },
            {
              "text": "parameters cities v1",
              "link": "/mulesoft/bot-xapi-services/v1/parameters-cities"
            },
            {
              "text": "parameters departments v1",
              "link": "/mulesoft/bot-xapi-services/v1/parameters-departments"
            },
            {
              "text": "parameters operators v1",
              "link": "/mulesoft/bot-xapi-services/v1/parameters-operators"
            },
            {
              "text": "parameters servicestypeportability v1",
              "link": "/mulesoft/bot-xapi-services/v1/parameters-servicestypeportability"
            },
            {
              "text": "salesOrder catalog v2",
              "link": "/mulesoft/bot-xapi-services/v2/salesOrder-catalog"
            },
            {
              "text": "salesOrder payments v1",
              "link": "/mulesoft/bot-xapi-services/v1/salesOrder-payments"
            },
            {
              "text": "salesOrder portabilities v1",
              "link": "/mulesoft/bot-xapi-services/v1/salesOrder-portabilities"
            },
            {
              "text": "salesOrder simcards v1",
              "link": "/mulesoft/bot-xapi-services/v1/salesOrder-simcards"
            }
          ]
        },
        {
          "text": "experience-xapi",
          "collapsed": false,
          "items": [
            {
              "text": "Descripción general",
              "link": "/mulesoft/experience-xapi-services/"
            },
            {
              "text": "customer privacy v2",
              "link": "/mulesoft/experience-xapi-services/v2/customer-privacy"
            }
          ]
        },
        {
          "text": "portal-xapi-services",
          "collapsed": false,
          "items": [
            {
              "text": "Descripción general",
              "link": "/mulesoft/portal-xapi-services/"
            },
            {
              "text": "normalizeAddressOp",
              "link": "/mulesoft/portal-xapi-services/v1/normalizeAddressOp"
            }
          ]
        }
      ]
    },
    {
      "text": "Catalogo Productos",
      "collapsed": true,
      "items": [
        {
          "text": "Descripción general",
          "link": "/catalogo-productos/"
        },
        {
          "text": "Experiencia",
          "collapsed": true,
          "items": [
            {
              "text": "Customers",
              "link": "/catalogo-productos/experiencia/customers"
            }
          ]
        },
        {
          "text": "Proceso",
          "collapsed": true,
          "items": []
        },
        {
          "text": "Sistema",
          "collapsed": true,
          "items": []
        }
      ]
    }
  ],
  "socialLinks": [
    {
      "icon": {
        "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" enable-background=\"new 0 0 24 24\" viewBox=\"0 0 24 24\" id=\"azure-devops\"><polygon fill=\"#0075D1\" points=\"2.966 8.331 18.021 5.403 10.652 0 10.652 2.476 2.247 5.899 0 8.871 0 15.714 2.966 16.57 2.966 8.331\"></polygon><polygon fill=\"#0075D1\" points=\"8.944 20.939 18.247 24 24 19.092 24 4.412 18.023 5.403 18.023 18.372 2.966 16.57 8.944 24 8.944 20.939\"></polygon><polygon fill=\"#0066B6\" points=\"10.652 0 10.652 2.476 2.247 5.899 0 8.871 0 15.714 2.966 16.57 2.966 8.331 12 6.574 12 .988 10.652 0\"></polygon><polygon fill=\"#0066B6\" points=\"2.966 16.57 8.944 24 8.944 20.939 12 21.944 12 17.651 2.966 16.57\"></polygon></svg>"
      },
      "link": "https://informaticaetb.visualstudio.com/"
    }
  ]
}

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.