1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 17:23:50 +01:00

put back schema.org meta tags

This commit is contained in:
Matthias Kretschmann 2019-11-25 21:51:18 +01:00
parent 2624723737
commit 5f49e5e083
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -16,55 +16,55 @@ const query = graphql`
} }
` `
// const createSchemaOrg = ( const createSchemaOrg = (
// blogURL: string, blogURL: string,
// title: string, title: string,
// postSEO: boolean, postSEO: boolean,
// postURL: string, postURL: string,
// image: string, image: string,
// description: string, description: string,
// author?: string author?: string
// ) => { ) => {
// const schemaOrgJSONLD: any = [ const schemaOrgJSONLD: any = [
// { {
// '@context': 'http://schema.org', '@context': 'http://schema.org',
// '@type': 'WebSite', '@type': 'WebSite',
// url: blogURL, url: blogURL,
// name: title name: title
// } }
// ] ]
// if (postSEO) { if (postSEO) {
// schemaOrgJSONLD.push({ schemaOrgJSONLD.push({
// '@context': 'http://schema.org', '@context': 'http://schema.org',
// '@type': 'BlogPosting', '@type': 'BlogPosting',
// author, author,
// publisher: author, publisher: author,
// url: postURL, url: postURL,
// name: title, name: title,
// headline: title, headline: title,
// image: { image: {
// '@type': 'ImageObject', '@type': 'ImageObject',
// url: image url: image
// }, },
// description description
// }) })
// } }
// return schemaOrgJSONLD return schemaOrgJSONLD
// } }
const MetaTags = ({ const MetaTags = ({
description, description,
image, image,
url, url,
// schema, schema,
postSEO, postSEO,
title title
}: { }: {
description: string description: string
image: string image: string
url: string url: string
// schema: string schema: string
postSEO: boolean postSEO: boolean
title: string title: string
}) => { }) => {
@ -83,7 +83,7 @@ const MetaTags = ({
<link rel="canonical" href={url} /> <link rel="canonical" href={url} />
{/* Schema.org tags */} {/* Schema.org tags */}
{/* <script type="application/ld+json">{schema}</script> */} <script type="application/ld+json">{JSON.stringify(schema)}</script>
{/* OpenGraph tags */} {/* OpenGraph tags */}
<meta property="og:url" content={url} /> <meta property="og:url" content={url} />
@ -123,7 +123,7 @@ export default function SEO({
}) { }) {
const data = useStaticQuery(query) const data = useStaticQuery(query)
const logo = data.logo.edges[0].node.relativePath const logo = data.logo.edges[0].node.relativePath
const { siteTitle, siteUrl, siteDescription } = useSiteMetadata() const { siteTitle, siteUrl, siteDescription, author } = useSiteMetadata()
let title let title
let description let description
@ -148,22 +148,22 @@ export default function SEO({
const blogURL = siteUrl const blogURL = siteUrl
const url = postSEO ? postURL : blogURL const url = postSEO ? postURL : blogURL
// const schema = createSchemaOrg( const schema = createSchemaOrg(
// blogURL, blogURL,
// title, title,
// postSEO, postSEO,
// postURL, postURL,
// image, image,
// description, description,
// author author.name
// ) )
return ( return (
<MetaTags <MetaTags
description={description} description={description}
image={image} image={image}
url={url} url={url}
// schema={(schema as unknown) as string} schema={(schema as unknown) as string}
postSEO={postSEO} postSEO={postSEO}
title={title} title={title}
/> />