mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
Merge pull request #19669 from ant-design/fix-site-helmet-title
chore: react-helmet-async title ssr
This commit is contained in:
commit
f6af1c6adf
@ -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",
|
||||
|
@ -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 {
|
||||
@ -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');
|
||||
});
|
||||
|
@ -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'
|
||||
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user