Add schema.org for blog posts

This commit is contained in:
Moris Zen
2018-09-12 14:43:25 +02:00
parent 4fae11d05d
commit a73b400ebe
2 changed files with 77 additions and 24 deletions

View File

@@ -4,39 +4,92 @@ import ImgIntro from '../images/web-development-company.svg'
class SEO extends Component {
render() {
const { siteTitle, siteDescription, siteImage, siteUrl} = this.props
const { siteTitle, siteDescription, siteImage, siteUrl, postSEO } = this.props
let title = siteTitle ? siteTitle : 'Saburly - App Development & Mobile Design agency that makes you stand out'
let desc = siteDescription ? siteDescription : 'We are in the business of solving real-world problems with digital solutions. Our mission is to make you stand out with the help of modern technologies'
let title = siteTitle
? siteTitle
: 'Saburly - App Development & Mobile Design agency that makes you stand out'
let desc = siteDescription
? siteDescription
: 'We are in the business of solving real-world problems with digital solutions. Our mission is to make you stand out with the help of modern technologies'
let img = siteImage ? siteImage : ImgIntro
let blogUrl = 'https://www.saburly.com/blog'
let pageUrl = siteUrl ? siteUrl : 'https://www.saburly.com'
const schemaOrgJSONLD = [
{
'@context': 'http://schema.org',
'@type': 'WebSite',
url: blogUrl,
name: title,
alternateName:
'Saburly - App Development & Mobile Design agency that makes you stand out',
},
]
if (postSEO) {
schemaOrgJSONLD.push(
{
'@context': 'http://schema.org',
'@type': 'BreadcrumbList',
itemListElement: [
{
'@type': 'ListItem',
position: 1,
item: {
'@id': pageUrl,
name: title,
image,
},
},
],
},
{
'@context': 'http://schema.org',
'@type': 'BlogPosting',
url: blogURL,
name: title,
alternateName:
'Saburly - App Development & Mobile Design agency that makes you stand out',
headline: title,
image: {
'@type': 'ImageObject',
url: img,
},
desc,
}
)
}
return (
<Helmet>
<title>
{title}
</title>
<meta name="description" content={desc} />
<meta name="image" content={img} />
<meta name="og:title" content={title} />
<meta name="og:description" content={desc} />
<meta name="og:image" content={img} />
<meta name="og:url" content={siteUrl ? siteUrl : 'https://www.saburly.com'} />
<meta name="og:site_name" content="Saburly.com" />
<meta name="fb:app_id" content="1896398823783343" />
<meta name="og:type" content="website" />
<meta itemprop="name" content={title} />
<meta itemprop="description" content={desc} />
<meta itemprop="image" content={img} />
<meta name="twitter:card" content="summary" />
<title>{title}</title>
<meta name="description" content={desc} />
<meta name="image" content={img} />
<script type="application/ld+json">
{JSON.stringify(schemaOrgJSONLD)}
</script>
<meta name="og:title" content={title} />
<meta name="og:description" content={desc} />
<meta name="og:image" content={img} />
<meta name="og:url" content={siteUrl ? siteUrl : blogUrl} />
<meta name="og:site_name" content="Saburly.com" />
<meta name="fb:app_id" content="1896398823783343" />
<meta name="og:type" content="website" />
<meta itemprop="name" content={title} />
<meta itemprop="description" content={desc} />
<meta itemprop="image" content={img} />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={desc} />
<meta name="twitter:site" content="@saburly" />
<meta name="twitter:creator" content="@saburly" />
<meta name="twitter:image:src" content={img} />
</Helmet>
</Helmet>
)
}
}

View File

@@ -20,7 +20,7 @@ class PostDefault extends Component {
const { data } = this.props
return (
<PageTransition>
<SEO siteTitle={data.wordpressPost.title} siteDescription="We are always on a lookout for exciting challenges. Feel free to contact us if you want to start something great or just have any questions" siteImage={data.wordpressPost.featured_media.source_url} siteUrl={`https://www.saburly.com/blog/${data.wordpressPost.slug}`} />
<SEO postSEO siteTitle={data.wordpressPost.title} siteDescription="We are always on a lookout for exciting challenges. Feel free to contact us if you want to start something great or just have any questions" siteImage={data.wordpressPost.featured_media.source_url} siteUrl={`https://www.saburly.com/blog/${data.wordpressPost.slug}`} />
<Helmet
link={[
{ rel: 'shortcut icon', type: 'image/png', href: `${favicon32}` },