src/components/blog/BlogPostItem/Container/index.tsx (21 lines of code) (raw):
/**
* 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 {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
import clsx from 'clsx';
// @ts-ignore
import {useBlogPost} from '@docusaurus/theme-common/internal';
export default function BlogPostItemContainer({children, className}) {
const {frontMatter, assets} = useBlogPost();
const {withBaseUrl} = useBaseUrlUtils();
const image = assets.image ?? frontMatter.image;
return (
<article
className={clsx('px-0 px-lg-5 pb-5 mb-5', className)}
itemProp="blogPost"
itemScope
itemType="http://schema.org/BlogPosting">
{image && (
<meta itemProp="image" content={withBaseUrl(image, {absolute: true})} />
)}
{children}
</article>
);
}