Add JSON+LD script component for SEO

This commit is contained in:
Jan Tuomi
2018-06-21 10:53:37 +03:00
parent 3ed5face1a
commit 238e719aa7
3 changed files with 28 additions and 0 deletions
+6
View File
@@ -5,6 +5,7 @@ import appStore from "../../stores/AppStore";
import Button from "../Button";
import { getPosts, Post as PostInterface } from "../../models/Post";
import Post from "../Post";
import JsonLD from "../JsonLD";
export interface AppProps {
appStore: {
@@ -57,6 +58,11 @@ export interface AppState {
<div className="app__landing__container--error">
{ this.state.error }
</div>
<JsonLD data={{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "https://sik.ayy.fi",
}} />
</div>;
}
}
+20
View File
@@ -0,0 +1,20 @@
import * as React from "react";
export interface JsonLDProps {
data: object;
}
class JsonLD extends React.Component<JsonLDProps, undefined> {
render() {
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(this.props.data),
}}
/>
);
}
}
export default JsonLD;
+2
View File
@@ -0,0 +1,2 @@
import JsonLD from "./JsonLD";
export default JsonLD;