diff options
author | 2024-04-06 14:10:07 +0200 | |
---|---|---|
committer | 2024-04-06 14:11:32 +0200 | |
commit | 807d331d1c7234e7f19075be790493dd1641feb1 (patch) | |
tree | 551b1f16a610502ce31aa5fd04b5ee4f909fe1dc /src/theme/BlogPostItem | |
parent | Add view source link (diff) | |
download | blog-807d331d1c7234e7f19075be790493dd1641feb1.tar.gz blog-807d331d1c7234e7f19075be790493dd1641feb1.tar.zst blog-807d331d1c7234e7f19075be790493dd1641feb1.zip |
Add favicon
Diffstat (limited to 'src/theme/BlogPostItem')
-rw-r--r-- | src/theme/BlogPostItem/Header/Author.tsx | 10 | ||||
-rw-r--r-- | src/theme/BlogPostItem/Header/Title.tsx | 8 |
2 files changed, 10 insertions, 8 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 | } |
diff --git a/src/theme/BlogPostItem/Header/Title.tsx b/src/theme/BlogPostItem/Header/Title.tsx index ced0916..9e19ec9 100644 --- a/src/theme/BlogPostItem/Header/Title.tsx +++ b/src/theme/BlogPostItem/Header/Title.tsx | |||
@@ -13,16 +13,16 @@ | |||
13 | 13 | ||
14 | import clsx from 'clsx'; | 14 | import clsx from 'clsx'; |
15 | import Link from '@docusaurus/Link'; | 15 | import Link from '@docusaurus/Link'; |
16 | import {useBlogPost} from '@docusaurus/theme-common/internal'; | 16 | import { useBlogPost } from '@docusaurus/theme-common/internal'; |
17 | import type {Props} from '@theme/BlogPostItem/Header/Title'; | 17 | import type { Props } from '@theme/BlogPostItem/Header/Title'; |
18 | 18 | ||
19 | import styles from './Title.module.css'; | 19 | import styles from './Title.module.css'; |
20 | 20 | ||
21 | export default function BlogPostItemHeaderTitle({ | 21 | export default function BlogPostItemHeaderTitle({ |
22 | className, | 22 | className, |
23 | }: Props): JSX.Element { | 23 | }: Props): JSX.Element { |
24 | const {metadata, isBlogPostPage} = useBlogPost(); | 24 | const { metadata, isBlogPostPage } = useBlogPost(); |
25 | const {permalink, title} = metadata; | 25 | const { permalink, title } = metadata; |
26 | const TitleHeading = isBlogPostPage ? 'h1' : 'h2'; | 26 | const TitleHeading = isBlogPostPage ? 'h1' : 'h2'; |
27 | return ( | 27 | return ( |
28 | <TitleHeading className={clsx(styles.title, className)}> | 28 | <TitleHeading className={clsx(styles.title, className)}> |