-
Notifications
You must be signed in to change notification settings - Fork 44
/
MetaInfo.js
executable file
·42 lines (34 loc) · 949 Bytes
/
MetaInfo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React, { Component } from 'react';
import { connect } from 'react-redux';
/* Vendor Components */
import MetaTags from 'react-meta-tags';
import removeMd from 'remove-markdown';
class MetaInfo extends Component {
render () {
const { tree } = this.props;
var title = "Nulis";
if (tree.name) {
title = tree.name + " - Nulis";
}
const description = removeMd(tree.cards.children[0].content).substring(0,120);
return (
<MetaTags>
{/* Main */}
<title>{title}</title>
<meta name="description"
content={description} />
{/* Facebook */}
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
{/* Twitter */}
<meta property="twitter:description" content={description}/>
</MetaTags>
);
}
}
function mapStateToProps(state) {
return {
tree: state.tree.present
};
}
export default connect(mapStateToProps, {})(MetaInfo);