summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Swithinbank2023-07-14 19:15:07 +0200
committerGitHub2023-07-14 19:15:07 +0200
commit2b3302b80451f318fb05a5e8a7284feb28999e66 (patch)
tree4e3433154f4a7b5741784ebb7debad0c34fc25b8
parent0600c1a917bf86efa6b2d053aa47e3a4b17e8049 (diff)
downloadIT.starlight-2b3302b80451f318fb05a5e8a7284feb28999e66.tar.gz
IT.starlight-2b3302b80451f318fb05a5e8a7284feb28999e66.tar.bz2
IT.starlight-2b3302b80451f318fb05a5e8a7284feb28999e66.zip
Add social link support for LinkedIn, Threads, and Twitch (#336)
-rw-r--r--.changeset/cool-beds-invent.md5
-rw-r--r--docs/src/content/docs/guides/customization.mdx6
-rw-r--r--docs/src/content/docs/reference/configuration.md5
-rw-r--r--packages/starlight/components/Icons.ts6
-rw-r--r--packages/starlight/components/SocialIcons.astro5
-rw-r--r--packages/starlight/utils/user-config.ts18
6 files changed, 32 insertions, 13 deletions
diff --git a/.changeset/cool-beds-invent.md b/.changeset/cool-beds-invent.md
new file mode 100644
index 00000000..05416c87
--- /dev/null
+++ b/.changeset/cool-beds-invent.md
@@ -0,0 +1,5 @@
+---
+"@astrojs/starlight": patch
+---
+
+Add support for LinkedIn, Threads, and Twitch social icon links
diff --git a/docs/src/content/docs/guides/customization.mdx b/docs/src/content/docs/guides/customization.mdx
index c711c30c..be11567e 100644
--- a/docs/src/content/docs/guides/customization.mdx
+++ b/docs/src/content/docs/guides/customization.mdx
@@ -178,7 +178,7 @@ defineConfig({
Starlight has built-in support for adding links to your social media accounts to the site header via the [`social`](/reference/configuration/#social) option in the Starlight integration.
-Currently, links to Codeberg, Discord, GitHub, Mastodon, Twitter, and Youtube are supported.
+Currently, links to Codeberg, Discord, GitHub, LinkedIn, Mastodon, Threads, Twitch, Twitter, and Youtube are supported.
Let us know on GitHub or Discord if you need support for another service!
```js
@@ -191,12 +191,8 @@ export default defineConfig({
starlight({
title: 'Docs With Social Links',
social: {
- codeberg: 'https://codeberg.org/knut/examples',
discord: 'https://astro.build/chat',
github: 'https://github.com/withastro/starlight',
- mastodon: 'https://m.webtoo.ls/@astro',
- twitter: 'https://twitter.com/astrodotbuild',
- youtube: 'https://youtube.com/@astrodotbuild',
},
}),
],
diff --git a/docs/src/content/docs/reference/configuration.md b/docs/src/content/docs/reference/configuration.md
index 275d9eb8..5f94e9c2 100644
--- a/docs/src/content/docs/reference/configuration.md
+++ b/docs/src/content/docs/reference/configuration.md
@@ -295,7 +295,7 @@ The default locale will be used to provide fallback content where translations a
### `social`
-**type:** `{ codeberg?: string; discord?: string; github?: string; mastodon?: string; twitter?: string; youtube?: string }`
+**type:** `Partial<Record<'codeberg' | 'discord' | 'github' | 'linkedin' | 'mastodon' | 'threads' | 'twitch' | 'twitter' | 'youtube', string>>`
Optional details about the social media accounts for this site. Adding any of these will display them as icon links in the site header.
@@ -305,7 +305,10 @@ starlight({
codeberg: 'https://codeberg.org/knut/examples',
discord: 'https://astro.build/chat',
github: 'https://github.com/withastro/starlight',
+ linkedin: 'https://www.linkedin.com/company/astroinc',
mastodon: 'https://m.webtoo.ls/@astro',
+ threads: 'https://www.threads.net/@nmoodev',
+ twitch: 'https://www.twitch.tv/bholmesdev',
twitter: 'https://twitter.com/astrodotbuild',
youtube: 'https://youtube.com/@astrodotbuild',
},
diff --git a/packages/starlight/components/Icons.ts b/packages/starlight/components/Icons.ts
index abb1aec4..dfe941ba 100644
--- a/packages/starlight/components/Icons.ts
+++ b/packages/starlight/components/Icons.ts
@@ -64,4 +64,10 @@ export const Icons = {
'<path d="M12 .5a12 12 0 0 0-12 12 12 12 0 0 0 1.8 6.4l10-13a.2.1 0 0 1 .4 0l10 13a12 12 0 0 0 1.8-6.4 12 12 0 0 0-12-12zm.3 6.5 4.4 16.5a12 12 0 0 0 5.2-4.2z"/>',
youtube:
'<path d="M23.5 6.2A3 3 0 0 0 21.4 4c-1.9-.5-9.4-.5-9.4-.5s-7.5 0-9.4.5A3 3 0 0 0 .5 6.3C0 8 0 12 0 12s0 4 .5 5.8A3 3 0 0 0 2.6 20c1.9.6 9.4.6 9.4.6s7.5 0 9.4-.6a3 3 0 0 0 2.1-2c.5-2 .5-5.9.5-5.9s0-4-.5-5.8zm-14 9.4V8.4l6.3 3.6-6.3 3.6z"/>',
+ threads:
+ '<path d="m17.73 11.2-.29-.13c-.17-3.13-1.88-4.92-4.75-4.94h-.04c-1.72 0-3.14.73-4.02 2.06l1.58 1.09a2.8 2.8 0 0 1 2.47-1.21c.94 0 1.66.28 2.12.81.33.4.56.93.67 1.61-.84-.14-1.74-.18-2.71-.13-2.73.16-4.49 1.75-4.37 3.97a3.41 3.41 0 0 0 1.57 2.71c.81.54 1.85.8 2.93.74a4.32 4.32 0 0 0 3.33-1.62 6 6 0 0 0 1.14-2.97 3.5 3.5 0 0 1 1.46 1.6 4 4 0 0 1-.98 4.4c-1.3 1.3-2.86 1.85-5.21 1.87-2.62-.02-4.6-.86-5.88-2.5-1.2-1.52-1.82-3.73-1.85-6.56.03-2.83.65-5.04 1.85-6.57 1.29-1.63 3.26-2.47 5.88-2.49 2.63.02 4.64.86 5.97 2.5.66.8 1.15 1.82 1.48 3l1.85-.5c-.4-1.44-1.02-2.7-1.86-3.73-1.71-2.1-4.21-3.19-7.44-3.21h-.01c-3.22.02-5.7 1.1-7.35 3.22C3.79 6.1 3.03 8.72 3 11.99V12c.03 3.29.79 5.9 2.27 7.78 1.66 2.12 4.13 3.2 7.35 3.22h.01c2.86-.02 4.88-.77 6.54-2.43a5.95 5.95 0 0 0 1.4-6.56 5.62 5.62 0 0 0-2.84-2.81Zm-4.94 4.64c-1.2.07-2.44-.47-2.5-1.62-.05-.85.6-1.8 2.57-1.92l.67-.02c.71 0 1.38.07 1.99.2-.23 2.84-1.56 3.3-2.73 3.36Z"/>',
+ linkedin:
+ '<path d="M20.47 2H3.53a1.45 1.45 0 0 0-1.47 1.43v17.14A1.45 1.45 0 0 0 3.53 22h16.94a1.45 1.45 0 0 0 1.47-1.43V3.43A1.45 1.45 0 0 0 20.47 2ZM8.09 18.74h-3v-9h3v9ZM6.59 8.48a1.56 1.56 0 0 1 0-3.12 1.57 1.57 0 1 1 0 3.12Zm12.32 10.26h-3v-4.83c0-1.21-.43-2-1.52-2A1.65 1.65 0 0 0 12.85 13a2 2 0 0 0-.1.73v5h-3v-9h3V11a3 3 0 0 1 2.71-1.5c2 0 3.45 1.29 3.45 4.06v5.18Z"/>',
+ twitch:
+ '<path d="M2.5 1 1 4.8v15.4h5.5V23h3.1l3-2.8H17l6-5.7V1H2.6ZM21 13.5l-3.4 3.3H12l-3 2.8v-2.8H4.5V3H21v10.5Zm-3.4-6.8v5.8h-2V6.7h2Zm-5.5 0v5.8h-2V6.7h2Z"/>',
};
diff --git a/packages/starlight/components/SocialIcons.astro b/packages/starlight/components/SocialIcons.astro
index 0e40922e..2dacbc84 100644
--- a/packages/starlight/components/SocialIcons.astro
+++ b/packages/starlight/components/SocialIcons.astro
@@ -10,7 +10,10 @@ const labels: Record<Platform, string> = {
twitter: 'Twitter',
mastodon: 'Mastodon',
codeberg: 'Codeberg',
- youtube: 'YouTube',
+ youtube: 'YouTube',
+ threads: 'Threads',
+ linkedin: 'LinkedIn',
+ twitch: 'Twitch',
};
const links = Object.entries(config.social || {}).filter(([, url]) =>
diff --git a/packages/starlight/utils/user-config.ts b/packages/starlight/utils/user-config.ts
index d29c8788..d87d6dd0 100644
--- a/packages/starlight/utils/user-config.ts
+++ b/packages/starlight/utils/user-config.ts
@@ -53,14 +53,14 @@ const AutoSidebarGroupSchema = SidebarGroupSchema.extend({
directory: z.string(),
/**
* Whether the autogenerated subgroups should be collapsed by default.
- * Defaults to the `AutoSidebarGroup` `collapsed` value.
+ * Defaults to the `AutoSidebarGroup` `collapsed` value.
*/
collapsed: z.boolean().optional(),
// TODO: not supported by Docusaurus but would be good to have
/** How many directories deep to include from this directory in the sidebar. Default: `Infinity`. */
// depth: z.number().optional(),
- })
-})
+ }),
+});
export type AutoSidebarGroup = z.infer<typeof AutoSidebarGroupSchema>;
type ManualSidebarGroupInput = z.input<typeof SidebarGroupSchema> & {
@@ -96,7 +96,7 @@ const ManualSidebarGroupSchema: z.ZodType<
])
.array()
),
-})
+});
const SidebarItemSchema = z.union([
SidebarLinkItemSchema,
@@ -139,6 +139,12 @@ const UserConfigSchema = z.object({
codeberg: z.string().url().optional(),
/** Link to the Youtube channel for this site, e.g. `'https://www.youtube.com/@astrodotbuild'`. */
youtube: z.string().url().optional(),
+ /** Link to the Threads profile for this site, e.g. `'https://www.threads.net/@nmoodev'`. */
+ threads: z.string().url().optional(),
+ /** Link to the LinkedIn page for this site, e.g. `'https://www.linkedin.com/company/astroinc'`. */
+ linkedin: z.string().url().optional(),
+ /** Link to the Twitch profile or repository for this site, e.g. `'https://www.twitch.tv/bholmesdev'`. */
+ twitch: z.string().url().optional(),
})
.optional(),
@@ -252,8 +258,8 @@ const UserConfigSchema = z.object({
.default(false)
.describe(
'Define if the last update date should be visible in the page footer.'
- ),
-
+ ),
+
/** Define if the previous and next page links should be visible in the page footer. */
pagination: z
.boolean()