afc163
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
39 additions and
40 deletions
-
.dumi/pages/404/index.tsx
-
.dumi/theme/common/CommonHelmet.tsx
-
.dumi/theme/slots/Content/index.tsx
|
|
@ -32,33 +32,25 @@ const NotFoundPage: React.FC<NotFoundProps> = ({ router }) => { |
|
|
|
|
|
|
|
// Report if necessary
|
|
|
|
const { yuyanMonitor } = window as any; |
|
|
|
if (yuyanMonitor) { |
|
|
|
yuyanMonitor.log({ |
|
|
|
code: 11, |
|
|
|
msg: `Page not found: ${location.href}; Source: ${document.referrer}`, |
|
|
|
}); |
|
|
|
} |
|
|
|
yuyanMonitor?.log({ |
|
|
|
code: 11, |
|
|
|
msg: `Page not found: ${location.href}; Source: ${document.referrer}`, |
|
|
|
}); |
|
|
|
}, []); |
|
|
|
|
|
|
|
return ( |
|
|
|
<div id="page-404"> |
|
|
|
<section> |
|
|
|
<Result |
|
|
|
status="404" |
|
|
|
title="404" |
|
|
|
subTitle={ |
|
|
|
isZhCN ? '你访问的页面貌似不存在?' : 'Sorry, the page you visited does not exist.' |
|
|
|
} |
|
|
|
extra={ |
|
|
|
<Link to={utils.getLocalizedPathname('/', isZhCN)}> |
|
|
|
<Button type="primary" icon={<HomeOutlined />}> |
|
|
|
{isZhCN ? '返回 Ant Design 首页' : 'Back to home page'} |
|
|
|
</Button> |
|
|
|
</Link> |
|
|
|
} |
|
|
|
/> |
|
|
|
</section> |
|
|
|
</div> |
|
|
|
<Result |
|
|
|
status="404" |
|
|
|
title="404" |
|
|
|
subTitle={isZhCN ? '你访问的页面貌似不存在?' : 'Sorry, the page you visited does not exist.'} |
|
|
|
extra={ |
|
|
|
<Link to={utils.getLocalizedPathname('/', isZhCN)}> |
|
|
|
<Button type="primary" icon={<HomeOutlined />}> |
|
|
|
{isZhCN ? '返回 Ant Design 首页' : 'Back to home page'} |
|
|
|
</Button> |
|
|
|
</Link> |
|
|
|
} |
|
|
|
/> |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
@ -5,10 +5,15 @@ const CommonHelmet = () => { |
|
|
|
const meta = useRouteMeta(); |
|
|
|
|
|
|
|
const [title, description] = useMemo(() => { |
|
|
|
const helmetTitle = `${meta.frontmatter.subtitle || ''} ${ |
|
|
|
meta.frontmatter?.title |
|
|
|
} - Ant Design`;
|
|
|
|
const helmetDescription = meta.frontmatter.description; |
|
|
|
let helmetTitle; |
|
|
|
if (!meta.frontmatter.subtitle && !meta.frontmatter.title) { |
|
|
|
helmetTitle = '404 Not Found - Ant Design'; |
|
|
|
} else { |
|
|
|
helmetTitle = `${meta.frontmatter.subtitle || ''} ${ |
|
|
|
meta.frontmatter?.title || '' |
|
|
|
} - Ant Design`;
|
|
|
|
} |
|
|
|
const helmetDescription = meta.frontmatter.description || ''; |
|
|
|
return [helmetTitle, helmetDescription]; |
|
|
|
}, [meta]); |
|
|
|
|
|
|
|
|
|
@ -187,18 +187,20 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => { |
|
|
|
</section> |
|
|
|
</Affix> |
|
|
|
<article css={styles.articleWrapper} className={classNames({ rtl: isRTL })}> |
|
|
|
<Typography.Title style={{ fontSize: 30 }}> |
|
|
|
{meta.frontmatter?.title} |
|
|
|
{meta.frontmatter.subtitle && ( |
|
|
|
<span style={{ marginLeft: 12 }}>{meta.frontmatter.subtitle}</span> |
|
|
|
)} |
|
|
|
{!pathname.startsWith('/components/overview') && ( |
|
|
|
<EditButton |
|
|
|
title={<FormattedMessage id="app.content.edit-page" />} |
|
|
|
filename={meta.frontmatter.filename} |
|
|
|
/> |
|
|
|
)} |
|
|
|
</Typography.Title> |
|
|
|
{meta.frontmatter?.title && meta.frontmatter.subtitle ? ( |
|
|
|
<Typography.Title style={{ fontSize: 30 }}> |
|
|
|
{meta.frontmatter?.title} |
|
|
|
{meta.frontmatter.subtitle && ( |
|
|
|
<span style={{ marginLeft: 12 }}>{meta.frontmatter.subtitle}</span> |
|
|
|
)} |
|
|
|
{!pathname.startsWith('/components/overview') && ( |
|
|
|
<EditButton |
|
|
|
title={<FormattedMessage id="app.content.edit-page" />} |
|
|
|
filename={meta.frontmatter.filename} |
|
|
|
/> |
|
|
|
)} |
|
|
|
</Typography.Title> |
|
|
|
) : null} |
|
|
|
{/* 添加作者、时间等信息 */} |
|
|
|
{meta.frontmatter.date || meta.frontmatter.author ? ( |
|
|
|
<Typography.Paragraph style={{ opacity: 0.65 }}> |
|
|
|