/
githubmirror
/
docusaurus
Обзор
Документация
Войти
/
githubmirror
/
docusaurus
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/docusaurus-theme-classic/src/theme/BlogPostPage/Metadata/index.tsx
44 строки
1 KB
Sébastien Lorber
refactor: prepare types for React 19 (#10746)
06 дек 2024, 20:03
Не верифицирован
06 дек 2024, 20:03
f9825af
Код
Авторство
О чём код?
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React, {type ReactNode} from 'react'; import {PageMetadata} from '@docusaurus/theme-common'; import {useBlogPost} from '@docusaurus/plugin-content-blog/client'; export default function BlogPostPageMetadata(): ReactNode { const {assets, metadata} = useBlogPost(); const {title, description, date, tags, authors, frontMatter} = metadata; const {keywords} = frontMatter; const image = assets.image ?? frontMatter.image; return ( <PageMetadata title={frontMatter.title_meta ?? title} description={description} keywords={keywords} image={image}> <meta property="og:type" content="article" /> <meta property="article:published_time" content={date} /> {/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */} {authors.some((author) => author.url) && ( <meta property="article:author" content={authors .map((author) => author.url) .filter(Boolean) .join(',')} /> )} {tags.length > 0 && ( <meta property="article:tag" content={tags.map((tag) => tag.label).join(',')} /> )} </PageMetadata> ); }