Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(blog): normalize inline authors socials #10424

Merged
merged 10 commits into from
Aug 29, 2024
6 changes: 6 additions & 0 deletions packages/docusaurus-plugin-content-blog/src/authors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import _ from 'lodash';
import {normalizeUrl} from '@docusaurus/utils';
import {normalizeSocials} from './authorsSocials';
import type {
Author,
AuthorsMap,
Expand Down Expand Up @@ -84,6 +85,7 @@ function getFrontMatterAuthors(params: AuthorsParam): Author[] {
// becoming a name and may end up unnoticed
return {key: authorInput};
}

return authorInput;
}

Expand Down Expand Up @@ -117,12 +119,16 @@ ${Object.keys(authorsMap)
...getAuthorsMapAuthor(frontMatterAuthor.key),
...frontMatterAuthor,
};
const normalizedSocials = normalizeSocials(frontMatterAuthor.socials ?? {});
OzakIOne marked this conversation as resolved.
Show resolved Hide resolved

return {
...author,
key: author.key ?? null,
page: author.page ?? null,
imageURL: normalizeImageUrl({imageURL: author.imageURL, baseUrl}),
...(Object.keys(normalizedSocials).length > 0 && {
socials: normalizedSocials,
}),
};
}
}
Expand Down