Do not set html lang attribute if there is no language set (#362)

* Do not set html lang attribute if there is no language set

* Prettier fixes
This commit is contained in:
Joel Marcey 2017-12-27 15:19:32 -08:00 committed by GitHub
parent 5a77f186b9
commit b0f26db3e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,8 +41,19 @@ class Site extends React.Component {
if (fs.existsSync(CWD + '/versions.json')) {
latestVersion = require(CWD + '/versions.json')[0];
}
// We do not want a lang attribute for the html tag if we don't have a language set
let htmlElementProps;
if (this.props.language) {
htmlElementProps = {
lang: this.props.language,
};
} else {
htmlElementProps = {};
}
return (
<html lang={this.props.language}>
<html {...htmlElementProps}>
<Head
config={this.props.config}
description={description}