-
-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement logo as found in the [google structure data documentation](https://developers.google.com/search/docs/data-types/logo) Related to #23
- Loading branch information
1 parent
6ae56d0
commit ca16cc1
Showing
7 changed files
with
144 additions
and
5 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
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,44 @@ | ||
import { versionSchemas } from '@cypress/schema-tools'; | ||
|
||
const logo100 = { | ||
version: { | ||
major: 1, | ||
minor: 0, | ||
patch: 0, | ||
}, | ||
schema: { | ||
type: 'object', | ||
title: 'Logo', | ||
description: 'An example schema describing JSON-LD for type: Logo', | ||
properties: { | ||
'@context': { | ||
type: 'string', | ||
description: 'Schema.org context', | ||
}, | ||
'@type': { | ||
type: 'string', | ||
description: 'Organization', | ||
}, | ||
logo: { | ||
type: 'string', | ||
description: | ||
'URL of a logo that is representative of the organization.', | ||
}, | ||
url: { | ||
type: 'string', | ||
description: 'The URL of the website associated with the logo.', | ||
}, | ||
}, | ||
required: true, | ||
additionalProperties: false, | ||
}, | ||
example: { | ||
'@context': 'http://schema.org', | ||
'@type': 'Organization', | ||
url: 'http://www.example.com', | ||
logo: 'http://www.example.com/images/logo.png', | ||
}, | ||
}; | ||
|
||
const logo = versionSchemas(logo100); | ||
export default logo; |
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,31 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Head from 'next/head'; | ||
|
||
import markup from '../utils/markup'; | ||
|
||
const LogoJsonLd = ({ url, logo }) => { | ||
const jslonld = `{ | ||
"@context": "http://schema.org", | ||
"@type": "Organization", | ||
"url": "${url}", | ||
"logo": "${logo}" | ||
}`; | ||
|
||
return ( | ||
<Head> | ||
<script | ||
type="application/ld+json" | ||
dangerouslySetInnerHTML={markup(jslonld)} | ||
key="jsonld-logo" | ||
/> | ||
</Head> | ||
); | ||
}; | ||
|
||
LogoJsonLd.propTypes = { | ||
url: PropTypes.string.isRequired, | ||
logo: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default LogoJsonLd; |