Skip to content

Commit 4c17f4d

Browse files
committed
fix: replace author handle with full name on blogs and individual blog posts recodehive#1730
1 parent 50dd460 commit 4c17f4d

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/pages/blogs/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ const BlogCard = ({ blog }: { blog: (typeof blogs)[number] }) => {
341341
rel="noopener noreferrer"
342342
title={author.name}
343343
>
344-
@{author.id || author.name.toLowerCase().replace(/\s+/g, "")}
344+
{author.name}
345345
</Link>
346346
</React.Fragment>
347347
))}

src/theme/BlogPostItem/Header/index.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ export default function BlogPostItemHeaderWrapper(props: Props): JSX.Element {
7878

7979
const blogDate = metadata.date
8080
? new Intl.DateTimeFormat(siteConfig.i18n?.defaultLocale || "en-US", {
81-
year: "numeric",
82-
month: "short",
83-
day: "numeric",
84-
}).format(new Date(metadata.date))
81+
year: "numeric",
82+
month: "short",
83+
day: "numeric",
84+
}).format(new Date(metadata.date))
8585
: undefined;
8686

8787
const tags = (metadata.tags ?? [])
@@ -121,10 +121,11 @@ export default function BlogPostItemHeaderWrapper(props: Props): JSX.Element {
121121
))}
122122
</div>
123123
{/* Handles after the stack (only authors with a handle) */}
124+
{/* Full name after the stack */}
124125
{authors
125-
.filter((author) => author.handle)
126+
.filter((author) => author.name || author.handle)
126127
.map((author, idx) => (
127-
<React.Fragment key={author.handle}>
128+
<React.Fragment key={author.handle ?? author.name}>
128129
{idx > 0 && (
129130
<span className={styles.authorSep} aria-hidden="true">
130131
,
@@ -137,10 +138,10 @@ export default function BlogPostItemHeaderWrapper(props: Props): JSX.Element {
137138
target="_blank"
138139
rel="noopener noreferrer"
139140
>
140-
{author.handle}
141+
{author.name || author.handle}
141142
</Link>
142143
) : (
143-
<span className={styles.handle}>{author.handle}</span>
144+
<span className={styles.handle}>{author.name || author.handle}</span>
144145
)}
145146
</React.Fragment>
146147
))}

0 commit comments

Comments
 (0)