Skip to content

Runtime API Examples

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": "favicon.ico",
  "nav": [
    {
      "text": "Home",
      "link": "/"
    },
    {
      "text": "Try demo",
      "link": "https://inkble.com"
    },
    {
      "text": "Contact US",
      "items": [
        {
          "text": "Telegram",
          "link": "https://t.me/Jolie_Inkble"
        },
        {
          "text": "Facebook",
          "link": "https://www.facebook.com/messages/t/323244550880043"
        }
      ]
    }
  ],
  "sidebar": {
    "/": [
      {
        "text": "Mục lục",
        "link": "/table_of_content"
      },
      {
        "text": "Đăng kí dịch vụ",
        "items": [
          {
            "text": "Đăng kí",
            "link": "/user/signup"
          },
          {
            "text": "Tạo tổ chức",
            "link": "/user/organizations"
          },
          {
            "text": "Thêm thành viên",
            "link": "/user/add_new_member"
          },
          {
            "text": "Phân quyền",
            "link": "/user/user_role"
          }
        ]
      },
      {
        "text": "Thống kê",
        "items": [
          {
            "text": "Biểu đồ",
            "link": "/analytics/data_chart"
          },
          {
            "text": "Thống kê đơn hàng",
            "link": "/dashboard"
          },
          {
            "text": "Doanh số cá nhân",
            "link": "/dashboard/user_dashboard"
          },
          {
            "text": "Tải dữ liệu doanh thu",
            "link": "/dashboard/download_data"
          }
        ]
      },
      {
        "text": "Sản phẩm",
        "items": [
          {
            "text": "Tạo sản phẩm",
            "link": "/product/create"
          },
          {
            "text": "Danh sách sản phẩm",
            "link": "/product/list_product"
          },
          {
            "text": "Bản mẫu",
            "link": "/product/template"
          },
          {
            "text": "Dữ liệu sản phẩm",
            "link": "/product/feed"
          }
        ]
      },
      {
        "text": "Danh mục sản phẩm",
        "items": [
          {
            "text": "Danh sách",
            "link": "/product/sort"
          }
        ]
      },
      {
        "text": "Đơn hàng",
        "items": [
          {
            "text": "Danh sách đơn hàng",
            "link": "/order"
          },
          {
            "text": "Tạo đơn hàng thủ công",
            "link": "/order/create_new_order"
          },
          {
            "text": "Cập nhật thông tin đơn hàng",
            "link": "/order/edit_order"
          },
          {
            "text": "Yêu cầu sản xuất",
            "link": "/order/fulfill"
          },
          {
            "text": "Theo dõi đơn hàng",
            "link": "/order/tracking"
          },
          {
            "text": "Cập nhật đơn hàng lỗi",
            "link": "/order/error_order"
          },
          {
            "text": "Nhập đơn hàng từ file excel",
            "link": "/order/import_order"
          },
          {
            "text": "Huỷ đơn hàng",
            "link": "/order/cancel_order"
          },
          {
            "text": "Hoàn tiền đơn hàng",
            "link": "/order/refund_order"
          }
        ]
      },
      {
        "text": "Thiết kế",
        "items": [
          {
            "text": "Đăng tải thiết kế",
            "link": "/design/upload_design"
          },
          {
            "text": "Thống kê",
            "link": "/design/dashboard"
          },
          {
            "text": "Danh sách",
            "link": "/design/list"
          },
          {
            "text": "Hỗ trợ Excel",
            "link": "/design/import_excel"
          }
        ]
      },
      {
        "text": "Ứng dụng",
        "items": [
          {
            "text": "Facebook",
            "items": [
              {
                "text": "Tài khoản",
                "link": "/facebook/get_token"
              },
              {
                "text": "Tạo camp",
                "link": "/facebook/create_camp"
              },
              {
                "text": "Danh sách camp",
                "link": "/facebook/list_camp"
              }
            ]
          }
        ]
      },
      {
        "text": "Cài đặt",
        "items": [
          {
            "text": "Tổng quan",
            "items": [
              {
                "text": "S3",
                "link": "/setting/S3"
              },
              {
                "text": "Google Storage",
                "link": "/setting/google_storage"
              },
              {
                "text": "Tổ chức",
                "link": "/setting/general"
              },
              {
                "text": "Múi giờ",
                "link": "/setting/timezone"
              }
            ]
          },
          {
            "text": "SKU",
            "link": "/setting/sku"
          },
          {
            "text": "Cửa hàng",
            "items": [
              {
                "text": "Shopify",
                "link": "/store/shopify"
              },
              {
                "text": "Shopbase",
                "link": "/store/shopbase"
              }
            ]
          },
          {
            "text": "Payment",
            "link": "/setting/billing"
          }
        ]
      },
      {
        "text": "Ứng dụng cho Shopify",
        "items": [
          {
            "text": "Inkble: Product Feeds",
            "items": [
              {
                "text": "Tạo feed",
                "link": "/shopify-app/product-feed/create"
              },
              {
                "text": "File CSV",
                "link": "/shopify-app/product-feed/csv"
              }
            ]
          }
        ]
      },
      {
        "text": "Tài liệu tham khảo API",
        "items": [
          {
            "text": "Access token",
            "link": "/api_reference/access_token"
          },
          {
            "text": "Kiểm tra thông tin",
            "link": "/api_reference/info"
          },
          {
            "text": "Tạo đơn hàng",
            "link": "/api_reference/order"
          }
        ]
      }
    ],
    "/en/": [
      {
        "text": "Table of content",
        "link": "/en/table_of_content"
      },
      {
        "text": "Register for the service",
        "items": [
          {
            "text": "Sign up",
            "link": "/en/user/signup"
          },
          {
            "text": "Create an organization",
            "link": "/en/user/organizations"
          },
          {
            "text": "Add new member",
            "link": "/en/user/add_new_member"
          },
          {
            "text": "Assign role",
            "link": "/en/user/user_role"
          }
        ]
      },
      {
        "text": "Dashboard",
        "items": [
          {
            "text": "Chart",
            "link": "/en/analytics/data_chart"
          },
          {
            "text": "Order statistics",
            "link": "/en/dashboard"
          },
          {
            "text": "Personal revenue",
            "link": "/en/dashboard/user_dashboard"
          },
          {
            "text": "Download revenue data",
            "link": "/en/dashboard/download_data"
          }
        ]
      },
      {
        "text": "Product",
        "items": [
          {
            "text": "Create product",
            "link": "/en/product/create"
          },
          {
            "text": "List of products",
            "link": "/en/product/list_product"
          },
          {
            "text": "Template",
            "link": "/en/product/template"
          },
          {
            "text": "\tProduct data",
            "link": "/en/product/feed"
          }
        ]
      },
      {
        "text": "List product",
        "items": [
          {
            "text": "List",
            "link": "/en/product/sort"
          }
        ]
      },
      {
        "text": "Order",
        "items": [
          {
            "text": "Order list",
            "link": "/en/order"
          },
          {
            "text": "Create order manually",
            "link": "/en/order/create_new_order"
          },
          {
            "text": "Update order information",
            "link": "/en/order/edit_order"
          },
          {
            "text": "Production requirement",
            "link": "/en/order/fulfill"
          },
          {
            "text": "Track order",
            "link": "/en/order/tracking"
          },
          {
            "text": "Update error order",
            "link": "/en/order/error_order"
          },
          {
            "text": "Import order from excel",
            "link": "/en/order/import_order"
          },
          {
            "text": "Cancel order",
            "link": "/en/order/cancel_order"
          },
          {
            "text": "Refund",
            "link": "/order/refund_order"
          }
        ]
      },
      {
        "text": "Design",
        "items": [
          {
            "text": "Upload design",
            "link": "/en/design/upload_design"
          },
          {
            "text": "Dashboard",
            "link": "/en/design/dashboard"
          },
          {
            "text": "List of designs",
            "link": "/en/design/list"
          },
          {
            "text": "Excel support",
            "link": "/en/design/import_excel"
          }
        ]
      },
      {
        "text": "Application",
        "items": [
          {
            "text": "Facebook",
            "items": [
              {
                "text": "Account",
                "link": "/en/facebook/get_token"
              },
              {
                "text": "Create camp",
                "link": "/en/facebook/create_camp"
              },
              {
                "text": "List of campaigns",
                "link": "/en/facebook/list_camp"
              }
            ]
          }
        ]
      },
      {
        "text": "Settings",
        "items": [
          {
            "text": "Overview",
            "items": [
              {
                "text": "S3",
                "link": "/en/setting/S3"
              },
              {
                "text": "Google Storage",
                "link": "/en/setting/google_storage"
              },
              {
                "text": "Organization",
                "link": "/en/setting/general"
              },
              {
                "text": "Time zone",
                "link": "/en/setting/timezone"
              }
            ]
          },
          {
            "text": "SKU",
            "link": "/en/setting/sku"
          },
          {
            "text": "Store",
            "items": [
              {
                "text": "Shopify",
                "link": "/en/store/shopify"
              },
              {
                "text": "Shopbase",
                "link": "/en/store/shopbase"
              }
            ]
          },
          {
            "text": "Payment",
            "link": "/en/setting/billing"
          }
        ]
      },
      {
        "text": "App for Shopify",
        "items": [
          {
            "text": "Inkble: Product Feeds",
            "items": [
              {
                "text": "Create Feed",
                "link": "/en/shopify-app/product-feed/create"
              },
              {
                "text": "File CSV",
                "link": "/en/shopify-app/product-feed/csv"
              }
            ]
          }
        ]
      },
      {
        "text": "Document API",
        "items": [
          {
            "text": "Access token",
            "link": "/en/api_reference/access_token"
          },
          {
            "text": "Verify information",
            "link": "/en/api_reference/info"
          },
          {
            "text": "Create order",
            "link": "/en/api_reference/order"
          }
        ]
      }
    ]
  },
  "socialLinks": []
}

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.