site: complete title

This commit is contained in:
Benjy Cui 2016-03-23 14:15:00 +08:00
parent f6d5653259
commit 0a701837eb
5 changed files with 32 additions and 0 deletions

View File

@ -3,6 +3,8 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Ant Design - 一个 UI 设计语言</title>
<link rel="icon" href="https://t.alipayobjects.com/images/T1QUBfXo4fXXXXXXXX.png" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="./index.css"/>
<!--[if lt IE 10]>
<script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.1.14/es5-shim.min.js,es5-shim/4.1.14/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js"></script>

View File

@ -12,6 +12,14 @@ export default class Article extends React.Component {
this.enhanceVideo = this.enhanceVideo.bind(this);
}
componentDidMount() {
this.componentDidUpdate();
}
componentDidUpdate() {
const { chinese, english } = this.props.content.meta;
utils.setTitle(`${chinese || english} - Ant Design`);
}
isPreviewImg(string) {
return /^<img\s/i.test(string) && /preview-img/gi.test(string);
}

View File

@ -15,6 +15,14 @@ export default class ComponentDoc extends React.Component {
};
}
componentDidMount() {
this.componentDidUpdate();
}
componentDidUpdate() {
const { chinese, english } = this.props.doc.meta;
utils.setTitle(`${chinese} ${english} - Ant Design`);
}
handleExpandToggle() {
this.setState({
expandAll: !this.state.expandAll,

View File

@ -7,7 +7,16 @@ import Page3 from './Page3';
import Page4 from './Page4';
import './index.less';
import * as utils from '../utils';
export default class Home extends React.Component {
componentDidMount() {
this.componentDidUpdate();
}
componentDidUpdate() {
utils.setTitle('Ant Design - 一个 UI 设计语言');
}
// To store style which is only for Home and has conflicts with others.
getStyle() {
return `

View File

@ -75,3 +75,8 @@ export function objectToComponent(pathname, object, index) {
children && children.map(objectToComponent.bind(null, pathname)) // `hr` has no children
);
}
const docTitle = document.head.querySelector('title');
export function setTitle(title) {
docTitle.text = title;
}