mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-09-14 20:24:56 +02:00
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
/**
|
|
* 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 from 'react';
|
|
import {PageMetadata} from '@docusaurus/theme-common';
|
|
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
export default function BlogPostPageMetadata() {
|
|
const {assets, metadata} = useBlogPost();
|
|
const {title, description, date, tags, authors, frontMatter} = metadata;
|
|
const {keywords} = frontMatter;
|
|
const image = assets.image ?? frontMatter.image;
|
|
return (
|
|
<PageMetadata
|
|
title={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>
|
|
);
|
|
}
|