GithubHelp home page GithubHelp logo

elmassimo / schema-org Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vueuse/schema-org

0.0 1.0 0.0 3.84 MB

๐Ÿ”Ž Quick and easy Schema.org graphs for Vue. With zero runtime and SSR

Home Page: https://vue-schema-org.netlify.app

TypeScript 71.09% CSS 2.73% HTML 0.98% Vue 25.20%

schema-org's Introduction

@vueuse/schema-org

NPM version NPM Downloads Docs & Demos
GitHub stars

The quickest and easiest way to build Schema.org graphs for Vue.


Status: ๐ŸŽ‰ v1 Released
Please report any issues ๐Ÿ›
Made possible by my Sponsor Program ๐Ÿ’–
Follow me @harlan_zw ๐Ÿฆ

Features

  • โœจ Powered by schema-org-graph-js: 20+ Schemas, automated relations, date and URL resolving
  • ๐Ÿค Integrations for VitePress, Nuxt v3, Vitesse and Vite with auto-imports
  • ๐Ÿž Choose your preferred API: Composables, Components or both!
  • โ›๏ธ Choose your provider: Simple (Google and Yoast best practices) and Full (schema-dts)
  • ๐ŸŒณ 0 kB JS runtime (by default), SSR, tree-shaking

Background

Implementing Schema.org is the easiest way to opt-in to Google Rich Results. The improved visibility of Rich Results has been shown to improve click-through rates.

Existing solutions to add Schema.org ld+json script tags work. However, implementing and maintaining Schema has issues:

  • @id relationships and URL references are brittle
  • Option paralysis in which Schema to implement and how
  • Limited and confusing documentation on best practices
  • Nested Schema adding unnecessary kB to page weight

This package aims to solve all of these issues, following the best practices from SEO giant Yoast and Google's own documentation.

Get Started

Docs

Framework guides:

Example

Transforms the below code into an embedded <script type="application/ld+json"> with the JSON content following it.

a. Composition API

useSchemaOrg([
  defineOrganization({
    name: 'Nuxt.js',
    logo: '/logo.png',
    sameAs: [
      'https://twitter.com/nuxt_js'
    ]
  }),
  defineWebSite({
    name: 'Nuxt',
  }),
  defineWebPage(),
])

b. Component API

<template>
<SchemaOrgOrganization 
  name="Nuxt.js" 
  logo="/logo.png"
  same-as="['https://twitter.com/nuxt_js']"
/>
<SchemaOrgWebSite name="Nuxt" />
<SchemaOrgWebPage/>
</template>

Output

{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Organization",
      "@id": "https://nuxtjs.org/#identity",
      "url": "https://nuxtjs.org/",
      "name": "Nuxt.js",
      "logo": {
        "@type": "ImageObject",
        "inLanguage": "en",
        "@id": "https://nuxtjs.org/#logo",
        "url": "https://nuxtjs.org/logo.png",
        "caption": "Nuxt.js",
        "contentUrl": "https://nuxtjs.org/logo.png"
      },
      "sameAs": [
        "https://twitter.com/nuxt_js"
      ],
      "image": {
        "@id": "https://nuxtjs.org/#logo"
      }
    },
    {
      "@type": "WebPage",
      "@id": "https://nuxtjs.org/#webpage",
      "url": "https://nuxtjs.org/",
      "potentialAction": [
        {
          "@type": "ReadAction",
          "target": [
            "https://nuxtjs.org/"
          ]
        }
      ],
      "about": {
        "@id": "https://nuxtjs.org/#identity"
      },
      "primaryImageOfPage": {
        "@id": "https://nuxtjs.org/#logo"
      },
      "isPartOf": {
        "@id": "https://nuxtjs.org/#website"
      }
    },
    {
      "@type": "WebSite",
      "@id": "https://nuxtjs.org/#website",
      "url": "https://nuxtjs.org/",
      "inLanguage": "en",
      "name": "Nuxt",
      "publisher": {
        "@id": "https://nuxtjs.org/#identity"
      }
    }
  ]
}

Sponsors

License

MIT License ยฉ 2022-PRESENT Harlan Wilton

schema-org's People

Contributors

harlan-zw avatar cyruscollier avatar mattschlosser avatar oritwoen avatar ibrahimbeladi avatar atinux avatar peterroe avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.