set title on pages
This commit is contained in:
parent
064177fbf7
commit
9b14fc82be
1 changed files with 6 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import hljs from 'highlight.js';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import Markdown from 'react-markdown';
|
import Markdown from 'react-markdown';
|
||||||
|
|
||||||
|
import config from './config';
|
||||||
import { NotFound } from './NotFound';
|
import { NotFound } from './NotFound';
|
||||||
import { slugify } from './util';
|
import { slugify } from './util';
|
||||||
|
|
||||||
|
|
@ -51,6 +52,10 @@ class Page extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
document.title = config.title;
|
||||||
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(props) {
|
componentWillReceiveProps(props) {
|
||||||
this.params = props.match.params;
|
this.params = props.match.params;
|
||||||
this.fetchPage();
|
this.fetchPage();
|
||||||
|
|
@ -62,6 +67,7 @@ class Page extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.page) {
|
if (this.state.page) {
|
||||||
|
document.title = `${config.title} - ${this.state.page.title}`;
|
||||||
return (
|
return (
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue