Skip to content

Commit

Permalink
Merge pull request #19669 from ant-design/fix-site-helmet-title
Browse files Browse the repository at this point in the history
chore: react-helmet-async title ssr
  • Loading branch information
ycjcl868 committed Nov 11, 2019
2 parents b74d1bd + a1acc79 commit f6af1c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"antd-theme-generator": "^1.1.6",
"babel-eslint": "^10.0.1",
"babel-plugin-add-react-displayname": "^0.0.5",
"bisheng": "^1.3.1-alpha.0",
"bisheng": "^1.3.3",
"bisheng-plugin-antd": "^1.3.1",
"bisheng-plugin-description": "^0.1.4",
"bisheng-plugin-react": "^1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions scripts/check-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const components = uniq(

describe('site test', () => {
let server;
const host = 3000;
const port = 3000;
const render = async path => {
const resp = await fetch(`http://localhost:${host}${path}`).then(async res => {
const resp = await fetch(`http://127.0.0.1:${port}${path}`).then(async res => {
const html = await res.text();
const $ = cheerio.load(html, { decodeEntities: false, recognizeSelfClosing: true });
return {
Expand Down Expand Up @@ -58,7 +58,7 @@ describe('site test', () => {
server = createServer({
root: join(process.cwd(), '_site'),
});
server.listen(host);
server.listen(port);
// eslint-disable-next-line no-console
console.log('site static server run: http://localhost:3000');
});
Expand Down
4 changes: 2 additions & 2 deletions site/theme/template/Layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default class Layout extends React.Component {
}

render() {
const { children, ...restProps } = this.props;
const { children, helmetContext = {}, ...restProps } = this.props;
const { appLocale } = this.state;
const title =
appLocale.locale === 'zh-CN'
Expand All @@ -119,7 +119,7 @@ export default class Layout extends React.Component {
? '基于 Ant Design 设计体系的 React UI 组件库,用于研发企业级中后台产品。'
: 'An enterprise-class UI design language and React UI library with a set of high-quality React components, one of best React UI library for enterprises';
return (
<HelmetProvider>
<HelmetProvider context={helmetContext}>
<Helmet encodeSpecialCharacters={false}>
<html lang={appLocale.locale === 'zh-CN' ? 'zh' : 'en'} />
<title>{title}</title>
Expand Down

0 comments on commit f6af1c6

Please sign in to comment.