UNPKG

vue-schema-org-integrations

Version:

Helper installs functions for frameworks. Currently, supporting Vite, VitePress and Vitesse.

30 lines (25 loc) 766 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const vueSchemaOrg = require('vue-schema-org'); const head = require('@vueuse/head'); function installSchemaOrg(ctx, options) { const isServer = typeof window === "undefined"; if (!ctx.app._context.provides.usehead) { const head$1 = head.createHead(); ctx.app.use(head$1); } const schemaOrg = vueSchemaOrg.createSchemaOrg({ ...options, customRouteMetaResolver: () => { return { ...ctx.router.route.data, ...ctx.router.route.data.frontmatter }; }, useHead: isServer ? false : head.useHead, useRoute: () => ctx.router.route }); ctx.app.use(schemaOrg); return schemaOrg; } exports.installSchemaOrg = installSchemaOrg;