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

{
  "logo": "logo-24.png",
  "search": {
    "provider": "local"
  },
  "nav": [
    {
      "text": "Home",
      "link": "/"
    },
    {
      "text": "Docs",
      "link": "/README"
    }
  ],
  "sidebar": [
    {
      "text": "📖 Introduction",
      "items": [
        {
          "text": "🚕 What is Ridy?",
          "link": "/README"
        },
        {
          "text": "⭐ Core Features",
          "link": "/core-features"
        },
        {
          "text": "🏗️ Architecture Overview",
          "link": "/architecture-overview"
        },
        {
          "text": "💻 System Requirements",
          "link": "/system-requirements"
        }
      ]
    },
    {
      "text": "🚀 Getting Started",
      "items": [
        {
          "text": "📋 Prerequisites",
          "link": "perquisites"
        },
        {
          "text": "📦 Installation Overview",
          "link": "installation-overview"
        }
      ]
    },
    {
      "text": "🖥️ Server-Side Setup",
      "items": [
        {
          "text": "📚 Server-Side Installation Overview",
          "link": "server-side-installation-overview"
        },
        {
          "text": "🐳 Server-Side Installation (Docker Mode)",
          "link": "server-side-installation-docker-mode"
        },
        {
          "text": "💻 Server-Side Installation (Dev Mode)",
          "link": "server-side-installation-dev-mode"
        },
        {
          "text": "⚙️ Server-Side Installation (Source Mode)",
          "link": "server-side-installation-source-mode"
        },
        {
          "text": "📁 Folder Structure",
          "link": "folder-structure"
        }
      ]
    },
    {
      "text": "📱 Client-Side Setup",
      "items": [
        {
          "text": "🏛️ Code Structure",
          "link": "client-code-structure"
        },
        {
          "text": "🔨 Building and Running Flutter Apps",
          "link": "building-and-running-flutter-apps"
        }
      ]
    },
    {
      "text": "⚙️ Configuration & Customization",
      "items": [
        {
          "text": "💰 Currency and Language Configuration",
          "link": "currency-and-language-configuration"
        },
        {
          "text": "🚗 Vehicle Types and Pricing Configuration",
          "link": "vehicle-types-and-pricing-configuration"
        }
      ]
    },
    {
      "text": "🚀 Deployment Options",
      "items": [
        {
          "text": "📚 Deployment Options Overview",
          "link": "deployment-options-overview"
        },
        {
          "text": "📲 Publish to Android's Play Store",
          "link": "deployment-options-play-store"
        },
        {
          "text": "📲 Publish to iOS's App Store",
          "link": "deployment-options-app-store"
        }
      ]
    },
    {
      "text": "👥 Using the System",
      "items": [
        {
          "text": "🧑‍💼 Customer App Workflows",
          "link": "customer-app-workflows"
        },
        {
          "text": "👨‍💼 Admin Workflows",
          "link": "admin-workflows"
        },
        {
          "text": "🚙 Driver App Workflows",
          "link": "driver-app-workflows"
        }
      ]
    },
    {
      "text": "🔒 Security",
      "items": [
        {
          "text": "🔐 HTTPS and SSL Setup",
          "link": "https-and-ssl-setup"
        }
      ]
    },
    {
      "text": "📋 Release Management",
      "items": [
        {
          "text": "⬆️ Upgrade Guide",
          "link": "upgrade-guide"
        },
        {
          "text": "📝 Changelog",
          "link": "changelog"
        },
        {
          "text": "🏷️ Versioning Policy",
          "link": "versioning-policy"
        }
      ]
    },
    {
      "text": "🛠️ Troubleshooting & FAQs",
      "items": [
        {
          "text": "❗ Common Errors and Resolutions",
          "link": "common-errors-and-resolutions"
        }
      ]
    },
    {
      "text": "📞 Support & Contact",
      "items": [
        {
          "text": "📧 Support SLA Contact Emails",
          "link": "support-sla-contact-emails"
        },
        {
          "text": "🐛 How to Report Issues",
          "link": "how-to-report-issues"
        },
        {
          "text": "📄 License Terms",
          "link": "license-terms"
        }
      ]
    }
  ],
  "socialLinks": [
    {
      "icon": {
        "svg": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg id=\"Layer_2\" data-name=\"Layer 2\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 543.23 543.23\"><defs><style>.cls-1{fill:#403bff;}</style></defs><g id=\"Layer_1-2\" data-name=\"Layer 1\"><g id=\"_29\" data-name=\"29\"><path id=\"_29-2\" data-name=\"29\" class=\"cls-1\" d=\"M94.25,348.38c-22.98,6.42-46.92,11.35-71.97,14.74-3.94.53-7.8-1.81-9.05-5.58-6.04-18.12-10.22-37.06-12.32-56.64-.62-5.78,4.58-10.4,10.23-9.04,24.8,5.97,49.43,10.2,73.84,12.64,3.72.37,6.82,2.93,7.84,6.52l7.51,26.39c1.34,4.7-1.36,9.65-6.07,10.97ZM145.69,139.25c6.65-6.34,13.76-12.19,21.3-17.48,2.95-2.07,4.27-5.71,3.22-9.16-7.22-23.78-12.83-48.46-16.85-73.99-.91-5.76-7.18-8.81-12.29-6-17.17,9.42-33.2,20.61-47.87,33.37-3,2.61-3.69,7.08-1.68,10.52,12.98,22.23,27,42.8,42.06,61.85,2.98,3.77,8.64,4.22,12.11.9ZM89.33,267.2c.43-7.86,1.24-19.38,2.43-27.87.49-3.46-1.19-6.81-4.28-8.46-21.94-11.72-43.38-25.22-64.29-40.45-4.71-3.43-11.3-1.16-12.93,4.43C4.86,213.29,1.4,232.52.02,252.35c-.28,3.97,2.4,7.63,6.25,8.65,25.03,6.59,49.61,11.24,73.86,14.06,4.74.55,8.94-3.08,9.21-7.85ZM205.82,100.25l25.95-7.43c3.56-1.02,6.09-4.11,6.45-7.8,2.44-24.79,7.02-49.3,13.62-73.5,1.6-5.85-3.12-11.38-9.15-10.74-19.71,2.09-38.77,6.27-57,12.35-3.77,1.26-6.11,5.12-5.58,9.06,3.38,25.05,8.31,48.99,14.72,71.98,1.32,4.72,6.28,7.42,11,6.07ZM104.01,197l13.26-23.96c1.81-3.28,1.42-7.29-.95-10.18-15.53-18.95-29.95-39.31-43.26-61.02-3.04-4.96-9.98-5.38-13.62-.85-12.07,14.99-22.55,31.28-31.27,48.63-1.79,3.56-.72,7.97,2.45,10.38,20.12,15.33,40.56,28.78,61.36,40.49,4.26,2.4,9.66.79,12.03-3.48ZM467.79,92.1c-21.98,11.66-42.67,25.15-62.07,40.35-3.83,3-4.43,8.65-1.38,12.45l17.4,21.76c2.2,2.76,5.85,3.85,9.23,2.83,23.95-7.24,48.45-12.38,73.44-15.51,6.02-.76,9.34-7.24,6.44-12.56-9.27-16.98-20.28-32.85-32.83-47.41-2.52-2.93-6.82-3.71-10.23-1.9ZM275.81,89.24c7.81.41,19.17,1.18,27.56,2.33,3.47.48,6.83-1.22,8.48-4.32,11.88-22.26,25.69-43.41,41.28-63.47,3.72-4.79,1.5-11.73-4.31-13.45C330.6,4.96,311.62,1.47,292.05.02c-3.86-.29-7.47,2.2-8.6,5.9-7.46,24.32-12.61,49.02-15.55,74.04-.57,4.85,3.04,9.02,7.92,9.28ZM345.97,103.81l23.83,13.11c3.25,1.79,7.22,1.38,10.08-.97,19.25-15.77,39.81-29.82,61.56-42.24,5.26-3,5.86-10.25,1.15-14.06-14.79-11.95-30.84-22.35-47.94-31.04-3.45-1.75-7.73-.84-10.2,2.14-15.87,19.18-29.85,39.55-41.97,61.01-2.4,4.25-.79,9.69,3.49,12.04ZM453.99,275.72c-.41,7.81-1.18,19.17-2.33,27.55-.48,3.48,1.23,6.83,4.32,8.48,22.26,11.88,43.41,25.69,63.46,41.28,4.79,3.72,11.74,1.51,13.45-4.31,5.37-18.21,8.86-37.19,10.31-56.77.29-3.86-2.2-7.47-5.9-8.6-24.32-7.46-49.02-12.62-74.04-15.56-4.85-.57-9.02,3.04-9.28,7.92ZM439.43,345.88l-13.11,23.84c-1.79,3.25-1.38,7.22.97,10.09,15.77,19.25,29.83,39.8,42.24,61.56,3,5.26,10.25,5.86,14.06,1.15,11.94-14.79,22.35-30.83,31.03-47.93,1.75-3.45.84-7.73-2.14-10.2-19.18-15.88-39.55-29.85-61.01-41.98-4.25-2.4-9.69-.79-12.04,3.49ZM398.33,404.25l-21.53,17.22c-2.89,2.31-4.03,6.13-2.97,9.67,7.2,23.86,12.31,48.28,15.43,73.17.76,6.02,7.24,9.34,12.56,6.44,16.98-9.27,32.85-20.28,47.41-32.83,2.93-2.52,3.71-6.82,1.9-10.23-11.66-21.98-25.15-42.67-40.35-62.06-3.01-3.83-8.65-4.43-12.45-1.38ZM442.89,205.48l7.51,26.13c1.02,3.55,4.11,6.08,7.79,6.44,24.8,2.46,49.31,7.07,73.51,13.69,5.84,1.6,11.39-3.12,10.75-9.14-2.04-19.3-6.09-37.99-11.97-55.88-1.2-3.67-4.87-6.03-8.71-5.67-24.78,2.33-49.05,6.85-72.8,13.45-4.7,1.31-7.42,6.3-6.07,10.98ZM197.09,439.23l-23.96-13.26c-3.28-1.81-7.29-1.42-10.18.95-18.95,15.53-39.31,29.95-61.03,43.25-4.96,3.04-5.38,9.98-.85,13.62,14.99,12.07,31.28,22.55,48.63,31.27,3.56,1.79,7.97.72,10.38-2.45,15.33-20.12,28.78-40.55,40.49-61.36,2.4-4.26.79-9.66-3.48-12.03ZM139.34,397.54c-6.34-6.65-12.19-13.76-17.48-21.3-2.07-2.95-5.71-4.27-9.16-3.22-23.78,7.22-48.46,12.83-73.99,16.85-5.76.91-8.81,7.18-6,12.29,9.42,17.17,20.61,33.2,33.37,47.88,2.61,3,7.08,3.69,10.52,1.68,22.24-12.98,42.8-27,61.85-42.06,3.77-2.98,4.22-8.64.9-12.11ZM267.29,453.9c-7.85-.43-19.37-1.24-27.86-2.43-3.46-.49-6.81,1.19-8.46,4.28-11.72,21.94-25.22,43.38-40.45,64.29-3.43,4.71-1.16,11.3,4.43,12.93,18.43,5.4,37.66,8.86,57.48,10.24,3.97.28,7.63-2.4,8.65-6.25,6.59-25.03,11.23-49.62,14.05-73.87.55-4.74-3.08-8.93-7.84-9.19ZM337.15,442.25c-8.37,3.22-17.03,5.84-25.93,7.81-3.53.78-6.15,3.65-6.5,7.25-2.39,24.72-6.63,49.66-12.66,74.77-1.36,5.66,3.26,10.87,9.04,10.24,19.14-2.06,37.68-6.1,55.43-11.94,3.67-1.2,6.03-4.87,5.67-8.71-2.36-25.09-6.97-49.67-13.71-73.7-1.36-4.83-6.65-7.52-11.34-5.72Z\"/></g></g></svg>"
      },
      "link": "https://bettersuite.io",
      "ariaLabel": "BetterSuite"
    },
    {
      "icon": "x",
      "link": "https://x.com/bettersuite_io"
    },
    {
      "icon": "facebook",
      "link": "https://www.facebook.com/bettersuite.io"
    },
    {
      "icon": "youtube",
      "link": "https://www.youtube.com/@bettersuite"
    }
  ]
}

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.