Add JSON+LD script component for SEO
This commit is contained in:
@@ -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>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -0,0 +1,2 @@
|
||||
import JsonLD from "./JsonLD";
|
||||
export default JsonLD;
|
||||
Reference in New Issue
Block a user