diff options
Diffstat (limited to 'src/theme/BlogPostItem/Header/Author.tsx')
-rw-r--r-- | src/theme/BlogPostItem/Header/Author.tsx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/theme/BlogPostItem/Header/Author.tsx b/src/theme/BlogPostItem/Header/Author.tsx index 226caee..7710a98 100644 --- a/src/theme/BlogPostItem/Header/Author.tsx +++ b/src/theme/BlogPostItem/Header/Author.tsx | |||
@@ -6,14 +6,16 @@ | |||
6 | 6 | ||
7 | import Author from '@theme-original/BlogPostItem/Header/Author'; | 7 | import Author from '@theme-original/BlogPostItem/Header/Author'; |
8 | import type AuthorType from '@theme/BlogPostItem/Header/Author'; | 8 | import type AuthorType from '@theme/BlogPostItem/Header/Author'; |
9 | import type {WrapperProps} from '@docusaurus/types'; | 9 | import type { WrapperProps } from '@docusaurus/types'; |
10 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | 10 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; |
11 | 11 | ||
12 | type Props = WrapperProps<typeof AuthorType>; | 12 | type Props = WrapperProps<typeof AuthorType>; |
13 | 13 | ||
14 | export default function AuthorWrapper(props: Props): JSX.Element { | 14 | export default function AuthorWrapper(props: Props): JSX.Element { |
15 | const { siteConfig: { url } } = useDocusaurusContext(); | 15 | const { |
16 | const newProps = {...props}; | 16 | siteConfig: { url }, |
17 | } = useDocusaurusContext(); | ||
18 | const newProps = { ...props }; | ||
17 | const { author } = props; | 19 | const { author } = props; |
18 | if (author.url !== undefined && author.url.startsWith(url)) { | 20 | if (author.url !== undefined && author.url.startsWith(url)) { |
19 | const newURL = author.url.substring(url.length); | 21 | const newURL = author.url.substring(url.length); |
@@ -23,5 +25,5 @@ export default function AuthorWrapper(props: Props): JSX.Element { | |||
23 | const newImageURL = author.imageURL.substring(url.length); | 25 | const newImageURL = author.imageURL.substring(url.length); |
24 | newProps.author.imageURL = newImageURL.replace(/\.jpg$/, '.webp'); | 26 | newProps.author.imageURL = newImageURL.replace(/\.jpg$/, '.webp'); |
25 | } | 27 | } |
26 | return <Author {...newProps} /> | 28 | return <Author {...newProps} />; |
27 | } | 29 | } |