From 081d1a969462633e41ca95a18a1ec121cb4af5d2 Mon Sep 17 00:00:00 2001 From: Chris Swithinbank Date: Wed, 5 Jun 2024 13:30:25 -0400 Subject: [PATCH] =?UTF-8?q?Add=20kudos=20option=20to=20add=20=E2=80=9CBuil?= =?UTF-8?q?t=20with=20Starlight=E2=80=9D=20badge=20to=20site=20footers=20(?= =?UTF-8?q?#1958)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Luiz Ferraz Co-authored-by: NotJaime13 <104889849+notjaime13@users.noreply.github.com> Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com> Co-authored-by: Florian Lefebvre Co-authored-by: Sarah Rainsberger Co-authored-by: liruifengv Co-authored-by: Adam Matthiesen <30383579+Adammatthiesen@users.noreply.github.com> Co-authored-by: Atharva Co-authored-by: trueberryless <99918022+trueberryless@users.noreply.github.com> Co-authored-by: Kevin <46791833+kevinzunigacuellar@users.noreply.github.com> Co-authored-by: Jacob Jenkins <7649031+jdtjenkins@users.noreply.github.com> Co-authored-by: Bryce Russell <19967622+BryceRussell@users.noreply.github.com> Co-authored-by: Lorenzo Lewis <15347255+lorenzolewis@users.noreply.github.com> --- .changeset/sharp-crabs-sparkle.md | 5 +++ .../content/docs/reference/configuration.mdx | 10 ++++++ .../__tests__/basics/config-errors.test.ts | 1 + packages/starlight/components/Footer.astro | 33 +++++++++++++++++-- packages/starlight/schemas/i18n.ts | 6 ++++ packages/starlight/translations/ar.json | 3 +- packages/starlight/translations/cs.json | 3 +- packages/starlight/translations/da.json | 3 +- packages/starlight/translations/de.json | 3 +- packages/starlight/translations/en.json | 3 +- packages/starlight/translations/es.json | 3 +- packages/starlight/translations/fa.json | 3 +- packages/starlight/translations/fr.json | 3 +- packages/starlight/translations/gl.json | 3 +- packages/starlight/translations/he.json | 3 +- packages/starlight/translations/hi.json | 3 +- packages/starlight/translations/id.json | 3 +- packages/starlight/translations/it.json | 3 +- packages/starlight/translations/ja.json | 3 +- packages/starlight/translations/ko.json | 3 +- packages/starlight/translations/nb.json | 3 +- packages/starlight/translations/nl.json | 3 +- packages/starlight/translations/pl.json | 3 +- packages/starlight/translations/pt.json | 3 +- packages/starlight/translations/ro.json | 3 +- packages/starlight/translations/ru.json | 3 +- packages/starlight/translations/sv.json | 3 +- packages/starlight/translations/tr.json | 3 +- packages/starlight/translations/uk.json | 3 +- packages/starlight/translations/vi.json | 3 +- packages/starlight/translations/zh-CN.json | 3 +- packages/starlight/translations/zh-TW.json | 3 +- packages/starlight/utils/user-config.ts | 6 ++++ 33 files changed, 113 insertions(+), 29 deletions(-) create mode 100644 .changeset/sharp-crabs-sparkle.md diff --git a/.changeset/sharp-crabs-sparkle.md b/.changeset/sharp-crabs-sparkle.md new file mode 100644 index 00000000000..3886c522fdd --- /dev/null +++ b/.changeset/sharp-crabs-sparkle.md @@ -0,0 +1,5 @@ +--- +'@astrojs/starlight': minor +--- + +Allows users to opt into displaying a “Built with Starlight” link in the site footer diff --git a/docs/src/content/docs/reference/configuration.mdx b/docs/src/content/docs/reference/configuration.mdx index 59816e1a87e..408416298fe 100644 --- a/docs/src/content/docs/reference/configuration.mdx +++ b/docs/src/content/docs/reference/configuration.mdx @@ -569,3 +569,13 @@ starlight({ ``` See the [Plugins Reference](/reference/plugins/) for details about creating your own plugins. + +### `credits` + +Enable displaying a “Built with Starlight” link in your site’s footer. + +```js +starlight({ + credits: true, +}); +``` diff --git a/packages/starlight/__tests__/basics/config-errors.test.ts b/packages/starlight/__tests__/basics/config-errors.test.ts index 551c560018c..63dcca59901 100644 --- a/packages/starlight/__tests__/basics/config-errors.test.ts +++ b/packages/starlight/__tests__/basics/config-errors.test.ts @@ -44,6 +44,7 @@ test('parses valid config successfully', () => { "ThemeSelect": "@astrojs/starlight/components/ThemeSelect.astro", "TwoColumnContent": "@astrojs/starlight/components/TwoColumnContent.astro", }, + "credits": false, "customCss": [], "defaultLocale": { "dir": "ltr", diff --git a/packages/starlight/components/Footer.astro b/packages/starlight/components/Footer.astro index a63eeb8df54..f75b5e40703 100644 --- a/packages/starlight/components/Footer.astro +++ b/packages/starlight/components/Footer.astro @@ -4,26 +4,55 @@ import type { Props } from '../props'; import EditLink from 'virtual:starlight/components/EditLink'; import LastUpdated from 'virtual:starlight/components/LastUpdated'; import Pagination from 'virtual:starlight/components/Pagination'; +import config from 'virtual:starlight/user-config'; +import { Icon } from '../components'; --- -