Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Video JSON-LD #547

Merged
merged 7 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 78 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,20 @@ const Page = () => (
'https://example.com/photos/16x9/photo.jpg',
],
expires: '2019-02-05T08:00:00+08:00',
hasPart: {
'@type': 'Clip',
name: 'Preheat oven',
startOffset: 30,
url: 'http://www.example.com/example?t=30',
},
watchCount: 2347,
publication: {
'@type': 'BroadcastEvent',
isLiveBroadcast: true,
startDate: '2020-10-24T14:00:00+00:00',
endDate: '2020-10-24T14:37:14+00:00',
},
regionsAllowed: ['IT', 'NL'],
}}
/>
</>
Expand Down Expand Up @@ -1432,8 +1445,8 @@ const Page = () => (
price: '119.99',
priceCurrency: 'USD',
priceValidUntil: '2020-11-05',
itemCondition: 'http://schema.org/UsedCondition',
availability: 'http://schema.org/InStock',
itemCondition: 'https://schema.org/UsedCondition',
availability: 'https://schema.org/InStock',
url: 'https://www.example.com/executive-anvil',
seller: {
name: 'Executive Objects',
Expand All @@ -1443,8 +1456,8 @@ const Page = () => (
price: '139.99',
priceCurrency: 'CAD',
priceValidUntil: '2020-09-05',
itemCondition: 'http://schema.org/UsedCondition',
availability: 'http://schema.org/InStock',
itemCondition: 'https://schema.org/UsedCondition',
availability: 'https://schema.org/InStock',
url: 'https://www.example.ca/executive-anvil',
seller: {
name: 'Executive Objects',
Expand Down Expand Up @@ -1580,6 +1593,67 @@ export default Page;

[Google Docs for Social Profile](https://developers.google.com/search/docs/data-types/social-profile)

### Video

```jsx
import { VideoJsonLd } from 'next-seo';

const Page = () => (
<>
<h1>Video JSON-LD</h1>
<VideoJsonLd
name="How to make a Party Coffee Cake"
description="This is how you make a Party Coffee Cake."
contentUrl="http://www.example.com/video123.mp4"
embedUrl="http://www.example.com/videoplayer?video=123"
uploadDate="2018-02-05T08:00:00+08:00"
duration="PT1M33S"
thumbnailUrls={[
'https://example.com/photos/1x1/photo.jpg',
'https://example.com/photos/4x3/photo.jpg',
'https://example.com/photos/16x9/photo.jpg',
]}
expires="2019-02-05T08:00:00+08:00"
hasPart={{
name: 'Preheat oven',
startOffset: 30,
url: 'http://www.example.com/example?t=30',
}}
watchCount={2347}
publication={{
isLiveBroadcast: true,
startDate: '2020-10-24T14:00:00+00:00',
endDate: '2020-10-24T14:37:14+00:00',
}}
regionsAllowed={['IT', 'NL']}
/>
</>
);

export default Page;
```

**Required properties**

| Property | Info |
| -------------- | ----------------------------------------------------------- |
| `name` | The title of the video. |
| `description` | The description of the video. HTML tags are ignored. |
| `thumbnailUrl` | A URL pointing to the video thumbnail image file. |
| `uploadDate` | The date the video was first published, in ISO 8601 format. |

**Recommended properties**

| Property | Info |
| ---------------------- | ---------------------------------------------------------------------------------------- |
| `contentUrl` | A URL pointing to the actual video media file, in one of the supported encoding formats. |
| `duration` | The duration of the video in ISO 8601 format |
| `embedUrl` | A URL pointing to a player for the specific video. |
| `expires` | If applicable, the date after which the video will no longer be available. |
| `interactionStatistic` | The number of times the video has been watched. |
| `publication` | If your video is happening live and you want to be eligible for the LIVE badge. |
| `regionsAllowed` | The regions where the video is allowed. |

### Event

```jsx
Expand Down
42 changes: 21 additions & 21 deletions cypress/e2e/jsonld.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[articleLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Article',
mainEntityOfPage: {
'@type': 'WebPage',
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[breadcrumbLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
itemListElement: [
{
Expand Down Expand Up @@ -150,7 +150,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[blogLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Blog',
mainEntityOfPage: {
'@type': 'WebPage',
Expand Down Expand Up @@ -190,7 +190,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[courseLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Course',
name: 'Course Name',
description: 'Course description goes right here',
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[localBusinessLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Store',
'@id': 'http://davesdeptstore.example.com',
name: "Dave's Department Store",
Expand Down Expand Up @@ -313,7 +313,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[productLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org/',
'@context': 'https://schema.org/',
'@type': 'Product',
name: 'Executive Anvil',
image: [
Expand Down Expand Up @@ -362,8 +362,8 @@ describe('Validates JSON-LD For:', () => {
price: '119.99',
priceCurrency: 'USD',
priceValidUntil: '2020-11-05',
itemCondition: 'http://schema.org/UsedCondition',
availability: 'http://schema.org/InStock',
itemCondition: 'https://schema.org/UsedCondition',
availability: 'https://schema.org/InStock',
url: 'https://www.example.com/executive-anvil',
seller: {
'@type': 'Organization',
Expand All @@ -375,8 +375,8 @@ describe('Validates JSON-LD For:', () => {
price: '139.99',
priceCurrency: 'CAD',
priceValidUntil: '2020-09-05',
itemCondition: 'http://schema.org/UsedCondition',
availability: 'http://schema.org/InStock',
itemCondition: 'https://schema.org/UsedCondition',
availability: 'https://schema.org/InStock',
url: 'https://www.example.ca/executive-anvil',
seller: {
'@type': 'Organization',
Expand Down Expand Up @@ -405,7 +405,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[socialProfileLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Person',
name: 'your name',
url: 'http://www.your-site.com',
Expand Down Expand Up @@ -485,7 +485,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[newsarticleLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'NewsArticle',
mainEntityOfPage: {
'@type': 'WebPage',
Expand Down Expand Up @@ -538,7 +538,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[faqPageLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org/',
'@context': 'https://schema.org/',
'@type': 'FAQPage',
mainEntity: [
{
Expand Down Expand Up @@ -579,7 +579,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[jobPostingLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'JobPosting',

baseSalary: {
Expand Down Expand Up @@ -641,7 +641,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[eventLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Event',
name: 'My Event',
startDate: '2020-01-23T00:00:00.000Z',
Expand Down Expand Up @@ -683,7 +683,7 @@ describe('Validates JSON-LD For:', () => {
.then(tags => {
const jsonLD = JSON.parse(tags[datasetLdJsonIndex].innerHTML);
expect(jsonLD).to.deep.equal({
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Dataset',
description:
'The description needs to be at least 50 characters long',
Expand Down Expand Up @@ -780,7 +780,7 @@ describe('Validates JSON-LD For:', () => {
duration: 'PT1M33S',
interactionStatistic: {
'@type': 'InteractionCounter',
interactionType: { '@type': 'http://schema.org/WatchAction' },
interactionType: { '@type': 'https://schema.org/WatchAction' },
userInteractionCount: 2347,
},
expires: '2019-02-05T08:00:00+08:00',
Expand Down Expand Up @@ -831,7 +831,7 @@ describe('Validates JSON-LD For:', () => {
'@type': 'ListItem',
position: '1',
item: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Course',
url: 'http://example.com/course-1.html',
name: 'Course 1',
Expand All @@ -846,7 +846,7 @@ describe('Validates JSON-LD For:', () => {
'@type': 'ListItem',
position: '2',
item: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Course',
url: 'http://example.com/course-2.html',
name: 'Course 2',
Expand Down Expand Up @@ -878,7 +878,7 @@ describe('Validates JSON-LD For:', () => {
'@type': 'ListItem',
position: '1',
item: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Movie',
name: 'Movie 1',
url: 'http://example.com/movie-1.html',
Expand All @@ -898,7 +898,7 @@ describe('Validates JSON-LD For:', () => {
'@type': 'ListItem',
position: '2',
item: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Movie',
name: 'Movie 2',
url: 'http://example.com/movie-1.html',
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/article-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const article100 = {
additionalProperties: false,
},
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Article',
mainEntityOfPage: {
'@type': 'WebPage',
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/blog-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const blog100 = {
additionalProperties: false,
},
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Blog',
mainEntityOfPage: {
'@type': 'WebPage',
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/breadcrumb-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const breadcrumb100 = {
additionalProperties: false,
},
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
itemListElement: [
{
Expand Down
8 changes: 4 additions & 4 deletions cypress/schemas/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ export const offers100 = {
priceCurrency: 'USD',
price: '119.99',
priceValidUntil: '2020-11-05',
itemCondition: 'http://schema.org/UsedCondition',
availability: 'http://schema.org/InStock',
itemCondition: 'https://schema.org/UsedCondition',
availability: 'https://schema.org/InStock',
seller: {
'@type': 'Organization',
name: 'Executive Objects',
Expand Down Expand Up @@ -203,8 +203,8 @@ export const offers101 = {
priceCurrency: 'USD',
price: '119.99',
priceValidUntil: '2020-11-05',
itemCondition: 'http://schema.org/UsedCondition',
availability: 'http://schema.org/InStock',
itemCondition: 'https://schema.org/UsedCondition',
availability: 'https://schema.org/InStock',
seller: {
'@type': 'Organization',
name: 'Executive Objects',
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/course-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const course100 = {
additionalProperties: false,
},
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Course',
name: 'Course Name',
description: 'Introductory CS course laying out the basics.',
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/dataset-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const dataset100 = {
additionalProperties: false,
},
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Dataset',
description: 'The description needs to be at least 50 characters long',
name: 'name of the dataset',
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/event-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const event100 = {
},
},
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Event',
name: 'My event',
startDate: '2020-01-23T00:00:00.000Z',
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/faq-page-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const faqPage100 = {
required: true,
},
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'FAQ Page',
mainEntity: [
{
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/job-posting-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ const jobPosting100 = {
required: true,
additionalProperties: false,
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'JobPosting',

baseSalary: {
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/local-business-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const localBusiness110 = {
additionalProperties: false,
},
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Store',
image: [
'https://example.com/photos/1x1/photo.jpg',
Expand Down
2 changes: 1 addition & 1 deletion cypress/schemas/logo-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const logo100 = {
additionalProperties: false,
},
example: {
'@context': 'http://schema.org',
'@context': 'https://schema.org',
'@type': 'Organization',
url: 'http://www.example.com',
logo: 'http://www.example.com/images/logo.png',
Expand Down
Loading