11import React from "react" ;
22import Link from "@docusaurus/Link" ;
3+ import useDocusaurusContext from "@docusaurus/useDocusaurusContext" ;
34import { useBlogPost } from "@docusaurus/plugin-content-blog/client" ;
45import BlogPostItemFooterOriginal from "@theme-original/BlogPostItem/Footer" ;
56import type BlogPostItemFooterType from "@theme/BlogPostItem/Footer" ;
@@ -9,6 +10,7 @@ import { getAuthorProfile } from "../../../utils/authors";
910import styles from "./styles.module.css" ;
1011
1112type Props = WrapperProps < typeof BlogPostItemFooterType > ;
13+ const META_SEPARATOR = " • " ;
1214
1315function getGitHubUrl ( author : {
1416 key ?: string ;
@@ -45,6 +47,7 @@ function getGitHubHandle(author: {
4547}
4648
4749export default function BlogPostItemFooterWrapper ( props : Props ) : JSX . Element {
50+ const { siteConfig } = useDocusaurusContext ( ) ;
4851 const { metadata, isBlogPostPage } = useBlogPost ( ) ;
4952 const primaryAuthor = metadata . authors ?. [ 0 ] ;
5053
@@ -77,12 +80,14 @@ export default function BlogPostItemFooterWrapper(props: Props): JSX.Element {
7780 profile ?. title ;
7881 const blogDate =
7982 metadata . date &&
80- new Intl . DateTimeFormat ( undefined , {
83+ new Intl . DateTimeFormat ( siteConfig . i18n ?. defaultLocale || "en-US" , {
8184 year : "numeric" ,
8285 month : "short" ,
8386 day : "numeric" ,
8487 } ) . format ( new Date ( metadata . date ) ) ;
85- const metaItems = [ authorHandle , blogDate , readTimeText ] . filter ( Boolean ) . join ( " • " ) ;
88+ const metaItems = [ authorHandle , blogDate , readTimeText ]
89+ . filter ( Boolean )
90+ . join ( META_SEPARATOR ) ;
8691
8792 const showAuthorCard = Boolean ( isBlogPostPage && primaryAuthor && authorName ) ;
8893
@@ -93,18 +98,18 @@ export default function BlogPostItemFooterWrapper(props: Props): JSX.Element {
9398 < section className = { styles . authorCard } aria-label = "Post author details" >
9499 < div className = { styles . authorBody } >
95100 < div className = { styles . authorAvatarWrapper } >
96- { authorAvatar ? (
97- < img
98- className = { styles . authorAvatar }
99- src = { authorAvatar }
100- alt = { `${ authorName } profile picture` }
101- loading = "lazy"
102- />
103- ) : (
104- < div className = { styles . authorAvatarFallback } aria-hidden = "true" >
105- { authorName ?. charAt ( 0 ) . toUpperCase ( ) }
106- </ div >
107- ) }
101+ { authorAvatar ? (
102+ < img
103+ className = { styles . authorAvatar }
104+ src = { authorAvatar }
105+ alt = { `${ authorName } profile picture` }
106+ loading = "lazy"
107+ />
108+ ) : (
109+ < div className = { styles . authorAvatarFallback } aria-hidden = "true" >
110+ { authorName ?. charAt ( 0 ) . toUpperCase ( ) }
111+ </ div >
112+ ) }
108113 < span className = { styles . verifiedBadge } aria-hidden = "true" >
109114 ✓
110115 </ span >
0 commit comments