Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jul 5, 2023
1 parent 2cf860d commit e4af21b
Show file tree
Hide file tree
Showing 168 changed files with 988 additions and 22,888 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
cache: "pnpm"
cache: pnpm

- run: pnpm i

Expand Down
131 changes: 6 additions & 125 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,135 +29,16 @@ The quickest and easiest way to build Schema.org graphs for Vue.
</table>
</p>

## Features
## New Package

- ✨ Powered by [unhead-schema-org](https://github.com/harlan-zw/unhead-schema-org): 20+ Schemas, automated relations, date and URL resolving
- 🤝 Integrations for [Nuxt v3](https://nuxtjs.org/), [Vitesse](https://nuxtjs.org/) and [Vite](https://vitejs.dev/) with auto-imports
- 🍞 Choose your preferred API: Composables, Components or both!
- 🇹 Fully typed for [Google](https://developers.google.com/search/docs/advanced/structured-data/search-gallery) and [Yoast](https://developer.yoast.com/features/schema/overview) best practices
- 🌳 **0 kB JS runtime** (by default), SSR, tree-shaking
[@unhead/schema-org](https://github.com/harlan-zw/unhead-schema-org)

## Background
The package `@vueuse/schema-org` has been superseded by [@unhead/schema-org](https://github.com/harlan-zw/unhead-schema-org) which offers
the same simple API.

Implementing Schema.org is the easiest way to opt-in to [Google Rich Results](https://developers.google.com/search/docs/advanced/structured-data/search-gallery).
The improved visibility of Rich Results has been shown
to [improve click-through rates](https://simplifiedsearch.net/case-study-the-impact-of-rich-results-on-impressions-clicks-and-organic-traffic/).

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](https://unhead-schema-org.harlanzw.com/guide/)

Framework guides:
- [Nuxt](https://unhead-schema-org.harlanzw.com/integrations/nuxt/module)
- [Vitesse](https://unhead-schema-org.harlanzw.com/integrations/vue/vitesse)
- [Vite](https://unhead-schema-org.harlanzw.com/integrations/vue/vite)

### Example

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

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

#### b. Component API

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

#### Output

```json
{
"@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"
}
}
]
}
```
This package will continue to mirror the API for the foreseeable future.

It's recommended to use `@unhead/schema-org` for new projects.

## Sponsors

Expand Down
File renamed without changes.
93 changes: 67 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,78 @@
{
"name": "@vueuse/schema-org-monorepo",
"private": true,
"packageManager": "[email protected]",
"name": "@vueuse/schema-org",
"type": "module",
"version": "2.2.0",
"description": "Schema.org for Vue. Supports typed and automated Google Rich Results",
"license": "MIT",
"description": "Vue Schema.org for Simple and Automated Google Rich Results for everyone",
"author": "Harlan Wilton <[email protected]>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
"homepage": "https://github.com/vueuse/schema-org#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/vueuse/schema-org.git",
"path": "packages/schema-org"
},
"bugs": {
"url": "https://github.com/vueuse/schema-org/issues"
},
"keywords": [
"vue",
"vue3",
"plugin",
"seo",
"schema.org",
"seo"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"./runtime": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
}
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"engines": {
"node": ">=14.0.0"
},
"scripts": {
"build": "pnpm -r --filter=./packages/nuxt run build && pnpm -r --filter=!./packages/nuxt run build",
"stub": "pnpm -r --parallel --filter=./packages/** run stub",
"lint": "eslint \"{packages,test}/**/*.{ts,vue,json,yml}\" --fix",
"release": "bumpp package.json packages/*/package.json --commit --push --tag",
"test": "vitest",
"test:update": "vitest -u"
"build": "unbuild .",
"stub": "unbuild . --stub",
"lint": "eslint . --fix",
"release": "bumpp package.json --commit --push --tag",
"test": "true",
"test:update": "true"
},
"peerDependencies": {
"@vueuse/head": ">=1.0.21",
"vue": ">=3.2.0"
},
"dependencies": {
"@unhead/schema-org-vue": "^0.6.0"
},
"devDependencies": {
"@antfu/eslint-config": "^0.39.3",
"@nuxt/test-utils": "3.5.1",
"@vitest/ui": "^0.31.1",
"bumpp": "^9.1.0",
"@antfu/eslint-config": "^0.39.7",
"@nuxt/test-utils": "3.6.1",
"@vitest/ui": "^0.32.4",
"bumpp": "^9.1.1",
"cheerio": "1.0.0-rc.12",
"eslint": "^8.41.0",
"jsdom": "^22.0.0",
"playwright": "^1.32.3",
"typescript": "^5.0.4",
"eslint": "^8.44.0",
"jsdom": "^22.1.0",
"playwright": "^1.35.1",
"typescript": "^5.1.6",
"unbuild": "^1.2.1",
"unhead": "^1.1.27",
"unhead": "^1.1.30",
"utility-types": "^3.10.0",
"vitest": "^0.31.1"
},
"pnpm": {
"overrides": {
"execa": "6.1.0"
}
"vitest": "^0.32.4"
}
}
22 changes: 0 additions & 22 deletions packages/nuxt/README.md

This file was deleted.

52 changes: 0 additions & 52 deletions packages/nuxt/package.json

This file was deleted.

Loading

0 comments on commit e4af21b

Please sign in to comment.