Skip to content

Commit

Permalink
feat(theme-classic): add description & keywords microdata to blog pos…
Browse files Browse the repository at this point in the history
…ts (#9108)
  • Loading branch information
TheCatLady committed Jun 29, 2023
1 parent ae2a093 commit 05156d0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,26 @@ export default function BlogPostItemContainer({
children,
className,
}: Props): JSX.Element {
const {frontMatter, assets} = useBlogPost();
const {
frontMatter,
assets,
metadata: {description},
} = useBlogPost();
const {withBaseUrl} = useBaseUrlUtils();
const image = assets.image ?? frontMatter.image;
const keywords = frontMatter.keywords ?? [];
return (
<article
className={className}
itemProp="blogPost"
itemScope
itemType="http://schema.org/BlogPosting">
{description && <meta itemProp="description" content={description} />}
{image && (
<meta itemProp="image" content={withBaseUrl(image, {absolute: true})} />
<link itemProp="image" href={withBaseUrl(image, {absolute: true})} />
)}
{keywords.length > 0 && (
<meta itemProp="keywords" content={keywords.join(',')} />
)}
{children}
</article>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ export default function BlogPostItemHeaderAuthor({
<div className={clsx('avatar margin-bottom--sm', className)}>
{imageURL && (
<MaybeLink href={link} className="avatar__photo-link">
<img className="avatar__photo" src={imageURL} alt={name} />
<img
className="avatar__photo"
src={imageURL}
alt={name}
itemProp="image"
/>
</MaybeLink>
)}

Expand Down

0 comments on commit 05156d0

Please sign in to comment.