Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
TeemuKoivisto committed Dec 24, 2018
1 parent be19007 commit d647693
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/ReactSEOMetaTags.tsx
Expand Up @@ -44,7 +44,7 @@ export class ReactSEOMetaTags extends React.PureComponent<ReactSEOMetaTagsProps>
/**
* https://developers.facebook.com/docs/sharing/webmasters/
* http://ogp.me/
* @param props
* @param props
*/
renderFacebook({ url, title, description, image, site, facebookAppId }: CombinedProps<FacebookProps>) {
return ([
Expand Down
95 changes: 48 additions & 47 deletions src/SchemaOrg.ts
Expand Up @@ -18,18 +18,17 @@ import {
* @param props
*/
const generateSiteJSONLD = ({ url, title, description, author } : WebsiteProps) => (
{
'@context': 'http://schema.org',
'@type': 'WebSite',
name: title,
url,
description,
author: {
'@type': author && author.schemaType,
name: author && author.name
}
{
'@context': 'http://schema.org',
'@type': 'WebSite',
name: title,
url,
description,
author: {
'@type': author && author.schemaType,
name: author && author.name
}
)
})

/**
* This schema is a bit tricker one but it's simply a showcase of your page on say Google results.
Expand All @@ -38,7 +37,7 @@ const generateSiteJSONLD = ({ url, title, description, author } : WebsiteProps)
* @param props
*/
const generateBreadcrumbList = ({ url, title, image } : WebsiteProps & BlogPostProps) => (
{
{
'@context': 'http://schema.org',
'@type': 'BreadcrumbList',
itemListElement: [
Expand All @@ -58,44 +57,46 @@ const generateBreadcrumbList = ({ url, title, image } : WebsiteProps & BlogPostP
* This is a general BlogPosting schema which covers quite a few attributes.
* @param props
*/
const generateBlogPosting = ({ url, title, description, image, datePublished, dateModified, tags, site, author, organization } : WebsiteProps & BlogPostProps) => (
{
'@context': 'http://schema.org',
'@type': 'BlogPosting',
url,
name: title,
headline: title,
keywords: tags,
description,
author: {
'@type': author && author.schemaType,
name: author && author.name
},
image: {
'@type': 'ImageObject',
url: image,
},
publisher: {
'@type': 'Organization',
url: organization && organization.url,
logo: organization && organization.logo,
name: organization && organization.name,
},
mainEntityOfPage: {
'@type': 'WebSite',
'@id': site && site.canonicalUrl,
},
datePublished,
dateModified, // Recommended by https://search.google.com/structured-data/testing-tool
// Reasoning https://bts.nomadgate.com/medium-evergreen-content
// Not only does Google prefer to feature more recent content in its search results, but
// users are also more likely to click an article with a recent date listed next to it.
// Does it make sense as you can just manipulate the date? Eeeh... Perhaps Google is aware of that.
})
const generateBlogPosting = ({
url, title, description, image, datePublished, dateModified,
tags, site, author, organization } : WebsiteProps & BlogPostProps) => (
{
'@context': 'http://schema.org',
'@type': 'BlogPosting',
url,
name: title,
headline: title,
keywords: tags,
description,
author: {
'@type': author && author.schemaType,
name: author && author.name
},
image: {
'@type': 'ImageObject',
url: image,
},
publisher: {
'@type': 'Organization',
url: organization && organization.url,
logo: organization && organization.logo,
name: organization && organization.name,
},
mainEntityOfPage: {
'@type': 'WebSite',
'@id': site && site.canonicalUrl,
},
datePublished,
dateModified, // Recommended by https://search.google.com/structured-data/testing-tool
// Reasoning https://bts.nomadgate.com/medium-evergreen-content
// Not only does Google prefer to feature more recent content in its search results, but
// users are also more likely to click an article with a recent date listed next to it.
// Does it make sense as you can just manipulate the date? Eeeh... Perhaps Google is aware of that.
})

/**
* Stringifying eliminates the undefined values, which keeps the JSON-LD somewhat tidy.
* Some empty objects might remain, but that shouldn't be a problem.
* Some empty objects might remain, but that shouldn't be a problem.
*/

export const createWebsiteJSONLD = (props: WebsiteProps) =>
Expand Down
7 changes: 5 additions & 2 deletions src/types.ts
Expand Up @@ -16,7 +16,8 @@ export interface WebsiteProps {
schemaType: string // 'Person', etc
}
site?: {
siteName?: string // "If your object is part of a larger web site, the name which should be displayed for the overall site. e.g., "IMDb"."
// "If your object is part of a larger web site, the name which should be displayed for the overall site. e.g., "IMDb"."
siteName?: string
canonicalUrl?: string // The index URL of the website (eg https://google.com), used for BlogPosting JSON-LD schema.
}
}
Expand All @@ -43,7 +44,9 @@ export interface TwitterProps {
}

export interface BlogPostProps {
url?: string // The canonical URL for your page. This should be the undecorated URL, without session variables, user identifying parameters, or counters.
// The canonical URL for your page. This should be the undecorated URL, without session
// variables, user identifying parameters, or counters.
url?: string
title: string // Title of the post. Max 70 characters.
description?: string // Should be a short description about the topic, <=200 words. Mainly for SEO purposes.
image?: string // Based on other SEO tags, an image of 1200x628 with 1.91:1 ratio in PNG, JPEG, or GIF is the optimum.
Expand Down
2 changes: 1 addition & 1 deletion tslint.json
Expand Up @@ -9,7 +9,7 @@
"function-name": false,
"align": [true, "parameters", "elements", "members", "statements"],
"import-name": false,
"object-shorthand-properties-first": false,
"object-shorthand-properties-first": false
},
"env": {
"jest": true
Expand Down

0 comments on commit d647693

Please sign in to comment.