-
-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db9cada
commit 0add384
Showing
7 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { versionSchemas } from '@cypress/schema-tools'; | ||
|
||
const dataset100 = { | ||
version: { | ||
major: 1, | ||
minor: 0, | ||
patch: 0, | ||
}, | ||
schema: { | ||
type: 'object', | ||
title: 'Dataset', | ||
description: 'An example schema describing JSON-LD for type: Dataset', | ||
properties: { | ||
'@context': { | ||
type: 'string', | ||
description: 'Schema.org context', | ||
}, | ||
'@type': { | ||
type: 'string', | ||
description: 'Dataset', | ||
}, | ||
description: { | ||
type: 'string', | ||
description: 'Description of the dataset', | ||
}, | ||
name: { | ||
type: 'string', | ||
description: 'Name of the dataset', | ||
}, | ||
license: { | ||
type: 'string', | ||
description: 'License for the dataset', | ||
}, | ||
}, | ||
required: true, | ||
additionalProperties: false, | ||
}, | ||
example: { | ||
'@context': 'http://schema.org', | ||
'@type': 'Dataset', | ||
description: 'The description needs to be at least 50 characters long', | ||
name: 'name of the dataset', | ||
license: 'https//www.example.com', | ||
}, | ||
}; | ||
|
||
const dataset = versionSchemas(dataset100); | ||
export default dataset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { FC } from 'react'; | ||
import Head from 'next/head'; | ||
|
||
import markup from '../utils/markup'; | ||
|
||
export interface DatasetJsonLdProps { | ||
description: string; | ||
name: string; | ||
license?: string; | ||
} | ||
|
||
const DatasetJsonLd: FC<DatasetJsonLdProps> = ({ | ||
description, | ||
name, | ||
license, | ||
}) => { | ||
const jslonld = `{ | ||
"@context": "http://schema.org", | ||
"@type": "Dataset", | ||
"description": "${description}", | ||
"name": "${name}"${ | ||
license | ||
? `, | ||
"license": "${license}"` | ||
: '' | ||
} | ||
}`; | ||
|
||
return ( | ||
<Head> | ||
<script | ||
type="application/ld+json" | ||
dangerouslySetInnerHTML={markup(jslonld)} | ||
key="jsonld-dataset" | ||
/> | ||
</Head> | ||
); | ||
}; | ||
|
||
export default DatasetJsonLd; |