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": {
    "alt": "Datatronic Logo",
    "dark": "/datatronic_logo_feher.svg",
    "light": "/datatronic_logo_kek.svg"
  },
  "siteTitle": " ",
  "search": {
    "provider": "local"
  },
  "nav": [
    {
      "text": "Home",
      "link": "/"
    },
    {
      "text": "Blogs",
      "link": "/blog/Blogs"
    }
  ],
  "sidebar": {
    "/cloud/": [
      {
        "text": "<div class=\"sidebar-item\"><img src=\"/cloud_basics.webp\"/>Architecture Concepts</div>",
        "collapsed": false,
        "items": [
          {
            "text": "Cloud Computing Characteristics",
            "link": "/cloud/Cloud-Basics"
          },
          {
            "text": "Cloud Migration",
            "link": "/cloud/Cloud-Migration"
          },
          {
            "text": "Service Models",
            "link": "/cloud/Cloud-Service-Models"
          },
          {
            "text": "Tenancy Models",
            "link": "/cloud/Cloud-Tenancy-Models"
          }
        ]
      },
      {
        "text": "<div class=\"sidebar-item\"><img src=\"/virtualization.webp\"/>Virtualisation</div>",
        "link": "/cloud/Cloud-Basics#virtualisation",
        "collapsed": true,
        "items": [
          {
            "text": "Server Virtualisation",
            "link": "/cloud/Cloud-Basics/#server-virtualisation"
          },
          {
            "text": "Desktop Virtualisation",
            "link": "/cloud/Cloud-Basics/#desktop-virtualisation"
          },
          {
            "text": "Network Virtualisation",
            "link": "/cloud/Cloud-Basics/#network-virtualisation"
          },
          {
            "text": "Storage Virtualisation",
            "link": "/cloud/Cloud-Basics/#storage-virtualisation"
          },
          {
            "text": "Applicaiton Virtualisation",
            "link": "/cloud/Cloud-Basics/#application-virtualisation"
          },
          {
            "text": "Hypervisors",
            "link": "/cloud/Cloud-Basics/#hypervisors"
          }
        ]
      }
    ],
    "/security/": [
      {
        "text": "<div class=\"sidebar-item\"><img src=\"/cloud_security.webp\"/>Cyber Security</div>",
        "collapsed": false,
        "items": [
          {
            "text": "Understanding Spams: Dangers and Protection",
            "link": "/security/understand-spams"
          },
          {
            "text": "Training Your Workforce On Cybersecurity",
            "link": "/security/train-employees-on-cybersecurity"
          },
          {
            "text": "Defending Websites and Applications 101",
            "link": "/security/defend-webapps-from-attacks"
          }
        ]
      },
      {
        "text": "<div class=\"sidebar-item\"><img src=\"/botnet.webp\"/>Attacks and Defenses</div>",
        "link": "/security/cyber-security",
        "collapsed": true,
        "items": [
          {
            "text": "Sever Side attacks",
            "link": "/security/attacks&defenses/server-side-attacks"
          }
        ]
      },
      {
        "text": "<div class=\"sidebar-item\"><img src=\"/cyber-security.webp\"/>The Basics</div>",
        "link": "/security/cyber-security",
        "collapsed": true,
        "items": [
          {
            "text": "Routers",
            "link": "/security/the-basics/routers"
          },
          {
            "text": "Firewalls",
            "link": "/security/the-basics/firewalls"
          }
        ]
      }
    ],
    "/oracle/": [
      {
        "text": "<div class=\"sidebar-item\"><img src=\"/oracle.svg\"/>Oracle APEX</div>",
        "collapsed": false,
        "items": [
          {
            "text": "Introduction",
            "link": "/oracle/APEX-Introduction"
          },
          {
            "text": "Using SQL Workshop",
            "link": "/oracle/APEX-Using SQL Workshop"
          },
          {
            "text": "App Builder Concepts",
            "link": "/oracle/APEX-App Builder Concepts"
          }
        ]
      }
    ],
    "/how-to/": [
      {
        "text": "<div class=\"sidebar-item\"><img src=\"/guide-book.webp\"/>Tutorials</div>",
        "collapsed": false,
        "items": [
          {
            "text": "Setting up an APN (HU)",
            "link": "/how-to/apn-setup-guide"
          },
          {
            "text": "Setting Up Thunderbird for Datatronic Mailing (HU)",
            "link": "/how-to/thunderbird-setup.md"
          }
        ]
      },
      {
        "text": "<div class=\"sidebar-item\"><img src=\"/schemathesis.webp\"/>Schemathesis</div>",
        "collapsed": true,
        "items": [
          {
            "text": "Quick Start a Schemathesis Test",
            "link": "/how-to/schemathesis/quick-start-test/schemathesis-quick-start-test.md"
          }
        ]
      }
    ],
    "/blog/": [
      {
        "text": "Blog",
        "collapsed": false,
        "items": [
          {
            "text": "Why is it so important to use a VPN?",
            "link": "/blog/importance-of-vpn"
          },
          {
            "text": "Key Characteristics of Cloud Computing",
            "link": "/blog/key-characteristics-of-cloud-computing"
          }
        ]
      }
    ],
    "/development/": [
      {
        "text": "Development",
        "collapsed": false,
        "items": []
      }
    ]
  },
  "socialLinks": [
    {
      "icon": "linkedin",
      "link": "https://hu.linkedin.com/company/datatronic-hu"
    },
    {
      "icon": {
        "svg": "<svg class=\"dci-social-icon\" xmlns=\"http://www.w3.org/2000/svg\"  viewBox=\"0 0 1772.000000 1773.000000\"  preserveAspectRatio=\"xMidYMid meet\"> <g transform=\"translate(0.000000,1773.000000) scale(0.100000,-0.100000)\"  stroke=\"none\"> <path d=\"M8823 13336 c-109 -36 -216 -134 -253 -234 -28 -74 -35 -172 -17 -242 l14 -55 -281 -283 -281 -282 -3 -485 -3 -485 -119 0 -120 0 0 303 c0 274 -2 306 -18 336 -20 37 -73 71 -110 71 -40 0 -91 -28 -112 -62 -19 -31 -20 -50 -20 -340 l0 -308 -122 0 -123 0 3 418 2 418 60 27 c116 54 200 166 223 300 29 171 -64 346 -223 421 -84 39 -208 48 -291 21 -114 -37 -194 -110 -247 -222 -24 -51 -27 -70 -27 -158 0 -91 3 -106 31 -165 39 -84 81 -131 155 -176 l59 -37 0 -423 0 -424 -119 0 -120 0 -3 294 -3 295 -29 30 c-49 51 -117 60 -174 23 -49 -32 -52 -50 -52 -357 l0 -285 -120 0 -120 0 0 464 c0 299 -4 475 -10 493 -6 15 -126 143 -266 284 l-255 255 12 30 c7 16 12 67 12 114 0 136 -51 241 -156 320 -74 56 -136 75 -247 75 -88 0 -101 -3 -162 -33 -85 -42 -148 -105 -190 -190 -31 -63 -33 -73 -33 -172 0 -99 2 -110 33 -172 81 -165 261 -255 437 -218 32 7 74 19 92 28 l34 16 219 -219 220 -220 0 -427 0 -428 -95 0 -95 0 0 -355 0 -355 -303 0 -302 0 -183 183 -183 184 21 64 c33 96 26 213 -18 302 -122 248 -448 302 -644 106 -87 -88 -130 -221 -109 -341 42 -240 267 -385 501 -324 l55 15 210 -209 c167 -167 219 -212 254 -225 36 -12 103 -15 372 -15 l329 0 0 -120 0 -119 -495 -3 -495 -3 -257 -256 c-235 -233 -260 -256 -283 -249 -14 5 -52 8 -86 9 -236 4 -423 -200 -400 -439 8 -86 59 -192 122 -249 93 -86 235 -128 352 -102 237 50 373 282 302 513 -10 35 -26 72 -34 83 -14 19 -3 32 192 228 l207 207 437 0 438 0 0 -120 0 -120 -251 0 c-280 0 -302 -4 -334 -64 -22 -41 -16 -117 11 -148 39 -44 69 -48 329 -48 l245 0 0 -120 0 -120 -501 0 c-555 0 -549 1 -584 -64 -22 -41 -16 -117 11 -148 43 -47 52 -48 579 -48 l495 0 0 -120 0 -120 -441 0 c-302 0 -447 -3 -462 -11 -12 -6 -131 -120 -265 -253 l-242 -241 -113 0 c-111 0 -115 -1 -189 -38 -159 -78 -238 -229 -216 -414 19 -170 153 -305 331 -336 171 -29 346 64 421 223 24 52 31 81 34 151 4 90 -3 129 -41 207 l-21 43 204 204 205 205 397 0 398 0 0 -375 0 -376 1183 3 c1096 3 1186 5 1241 21 171 51 263 105 382 222 95 94 142 165 188 279 58 145 57 104 54 1369 l-3 1162 -33 95 c-57 163 -144 289 -271 390 -64 51 -183 116 -253 139 l-38 13 0 441 0 442 239 239 239 238 58 -22 c82 -32 206 -32 287 -1 328 127 345 586 27 735 -55 25 -79 31 -155 33 -57 2 -106 -2 -132 -11z m221 -234 c52 -36 76 -84 76 -150 0 -63 -16 -98 -64 -140 -85 -75 -226 -45 -278 59 -10 19 -18 56 -18 83 0 148 163 233 284 148z m-3606 -26 c114 -60 138 -212 46 -298 -16 -15 -42 -32 -57 -37 -73 -28 -174 -1 -215 56 -28 39 -44 107 -36 148 8 47 54 107 95 128 42 20 131 22 167 3z m1801 -420 c16 -9 43 -33 58 -53 25 -32 28 -45 28 -108 0 -63 -3 -76 -29 -109 -51 -68 -138 -92 -214 -61 -77 33 -112 86 -112 170 0 83 34 135 110 170 41 18 114 14 159 -9z m-2669 -1376 c46 -23 74 -60 89 -118 15 -54 6 -102 -29 -150 -35 -49 -84 -72 -150 -72 -103 0 -180 76 -180 180 0 72 42 138 105 166 45 20 120 17 165 -6z m3169 -735 c191 -46 352 -195 419 -390 l27 -80 0 -650 c0 -603 -1 -654 -18 -710 -25 -81 -78 -180 -127 -237 -54 -62 -175 -142 -258 -170 -66 -22 -74 -23 -679 -26 l-613 -3 0 1141 0 1140 593 0 c492 0 603 -3 656 -15z m-3462 -1221 c57 -27 87 -76 91 -150 4 -54 1 -70 -21 -106 -58 -100 -197 -119 -280 -40 -42 40 -57 75 -57 134 0 103 75 178 178 178 30 0 70 -7 89 -16z m82 -1499 c119 -61 132 -230 24 -312 -32 -25 -45 -28 -108 -28 -63 0 -76 3 -109 29 -106 81 -97 236 19 307 37 23 134 25 174 4z\"/> <path d=\"M7255 9707 c-90 -30 -144 -75 -186 -157 -34 -64 -34 -196 -1 -257 58 -111 145 -165 264 -166 118 0 205 49 266 152 20 35 27 61 30 127 4 72 1 89 -20 136 -29 63 -83 119 -143 148 -54 26 -157 34 -210 17z\"/> <path d=\"M10205 11259 c-167 -23 -371 -97 -492 -180 -186 -127 -329 -350 -362 -568 -20 -128 -31 -505 -31 -1086 0 -927 24 -1185 130 -1400 119 -242 375 -401 735 -456 119 -18 401 -16 514 5 287 51 542 205 680 412 109 163 144 351 157 852 l7 252 -485 0 -486 0 -5 -377 c-3 -223 -9 -394 -15 -418 -16 -60 -61 -95 -122 -95 -61 0 -105 34 -122 95 -16 53 -23 2043 -9 2162 16 133 42 165 136 167 65 0 100 -21 116 -71 9 -27 14 -171 16 -490 l4 -453 485 0 484 0 0 213 c0 416 -28 712 -84 875 -36 109 -81 177 -177 272 -138 137 -304 223 -524 270 -115 25 -430 36 -550 19z\"/> <path d=\"M11980 9415 l0 -1785 480 0 480 0 0 1785 0 1785 -480 0 -480 0 0 -1785z\"/></g></svg>"
      },
      "link": "https://datatronic.cloud",
      "ariaLabel": "DCI"
    },
    {
      "icon": {
        "svg": "<svg class=\"dt-social-icon\" xmlns=\"http://www.w3.org/2000/svg\"  viewBox=\"0 0 457.000000 388.000000\"  preserveAspectRatio=\"xMidYMid meet\"> <metadata> Created by potrace 1.16, written by Peter Selinger 2001-2019 </metadata> <g transform=\"translate(0.000000,388.000000) scale(0.100000,-0.100000)\"  stroke=\"none\"> <path d=\"M989 3353 l-65 -4 -227 -1296 c-125 -713 -226 -1297 -224 -1299 6 -7 397 -27 403 -21 6 6 465 2609 461 2613 -5 5 -288 11 -348 7z\"/> <path d=\"M1497 3328 c-16 -69 -70 -409 -65 -413 4 -4 93 -14 258 -28 24 -2 25 0 61 203 21 113 38 212 38 221 1 15 -17 18 -126 24 -71 3 -135 9 -144 11 -11 3 -18 -3 -22 -18z\"/> <path d=\"M1950 3308 c0 -2 -18 -102 -39 -223 -21 -121 -38 -221 -37 -222 1 -1 67 -16 147 -33 79 -16 160 -34 179 -40 19 -5 37 -6 41 -2 6 7 80 425 79 453 0 13 -29 20 -157 38 -87 12 -170 25 -185 27 -16 3 -28 4 -28 2z\"/> <path d=\"M2480 3217 c0 -2 -18 -106 -40 -231 -22 -125 -40 -233 -40 -240 0 -6 51 -32 113 -55 295 -114 518 -268 614 -424 31 -49 38 -56 45 -41 9 22 128 703 128 732 0 34 -320 146 -649 227 -136 33 -171 39 -171 32z\"/> <path d=\"M3450 2889 c0 -6 -72 -423 -160 -926 -89 -504 -159 -917 -157 -920 8 -7 187 67 332 137 375 183 633 422 718 668 26 75 30 101 30 192 0 91 -4 117 -30 192 -77 221 -283 429 -608 612 -101 56 -125 65 -125 45z\"/> <path d=\"M3035 1700 c-154 -157 -506 -332 -815 -405 -41 -10 -76 -19 -78 -20 -3 -3 -82 -452 -82 -470 0 -20 23 -19 197 10 182 31 378 74 560 123 l138 38 67 380 c37 208 66 383 65 387 -1 4 -25 -15 -52 -43z\"/> <path d=\"M1920 1228 c-25 -5 -109 -17 -188 -27 -79 -10 -147 -22 -151 -27 -5 -5 -23 -94 -40 -199 -18 -104 -35 -202 -38 -216 -5 -26 -4 -27 38 -23 24 2 112 9 194 15 83 6 151 12 153 13 4 5 82 460 80 466 -2 3 -23 2 -48 -2z\"/> <path d=\"M1221 1161 l-105 -6 -32 -185 c-18 -102 -36 -200 -39 -219 l-7 -34 148 6 c81 4 148 8 150 9 3 4 74 410 74 426 0 12 -2 12 -189 3z\"/> </g> </svg> "
      },
      "link": "https://datatronic.ai",
      "ariaLabel": "Datatronic"
    }
  ]
}

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.