aboutsummaryrefslogtreecommitdiffstats
path: root/src/theme/BlogPostItem/Header/Author.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/theme/BlogPostItem/Header/Author.tsx')
-rw-r--r--src/theme/BlogPostItem/Header/Author.tsx10
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
7import Author from '@theme-original/BlogPostItem/Header/Author'; 7import Author from '@theme-original/BlogPostItem/Header/Author';
8import type AuthorType from '@theme/BlogPostItem/Header/Author'; 8import type AuthorType from '@theme/BlogPostItem/Header/Author';
9import type {WrapperProps} from '@docusaurus/types'; 9import type { WrapperProps } from '@docusaurus/types';
10import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 10import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
11 11
12type Props = WrapperProps<typeof AuthorType>; 12type Props = WrapperProps<typeof AuthorType>;
13 13
14export default function AuthorWrapper(props: Props): JSX.Element { 14export 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}