Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ describe('normalizeSocials', () => {
expect(normalizeSocials(socials)).toEqual(socials);
});

it('supports LinkedIn company handles', () => {
const socials: AuthorSocials = {
linkedin: 'company/docusaurus',
};

expect(normalizeSocials(socials)).toEqual({
linkedin: 'https://www.linkedin.com/company/docusaurus/',
});
});

it('mixed links', () => {
const socials: AuthorSocials = {
twitter: 'ozakione',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const PredefinedPlatformNormalizers: Record<
x: (handle: string) => `https://x.com/${handle}`,
twitter: (handle: string) => `https://twitter.com/${handle}`,
github: (handle: string) => `https://github.com/${handle}`,
linkedin: (handle: string) => `https://www.linkedin.com/in/${handle}/`,
linkedin: (handle: string) =>
`https://www.linkedin.com/${handle.startsWith('company/') ? handle : `in/${handle}`}/`,
stackoverflow: (userId: string) =>
`https://stackoverflow.com/users/${userId}`,
bluesky: (handle: string) => `https://bsky.app/profile/${handle}`,
Expand All @@ -66,7 +67,10 @@ Social platform '${platform}' has illegal value '${value}'`,
value.startsWith('mailto:');
if (isAbsoluteUrl) {
return [platform, value];
} else if (value.includes('/')) {
} else if (
value.includes('/') &&
!(platform.toLowerCase() === 'linkedin' && value.startsWith('company/'))
) {
throw new Error(
`Author socials should be usernames/userIds/handles, or fully qualified HTTP(s) absolute URLs.
Social platform '${platform}' has illegal value '${value}'`,
Expand Down