@astrojs/starlight 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/404.astro CHANGED
@@ -6,7 +6,10 @@ import Page from './layout/Page.astro';
6
6
  import type { StarlightDocsEntry } from './utils/routing';
7
7
  import { useTranslations } from './utils/translations';
8
8
 
9
- const { lang = 'en', dir = 'ltr', locale } = config.defaultLocale || {};
9
+ const { lang = 'en', dir = 'ltr' } = config.defaultLocale || {};
10
+ let locale = config.defaultLocale?.locale;
11
+ if (locale === 'root') locale = undefined;
12
+
10
13
  const entryMeta = { dir, lang, locale };
11
14
  const t = useTranslations(locale);
12
15
 
@@ -34,6 +37,6 @@ const entry = userEntry || fallbackEntry;
34
37
  const { Content, headings } = await entry.render();
35
38
  ---
36
39
 
37
- <Page {headings} entry={entry} slug={entry.slug} {...entryMeta} {entryMeta}>
40
+ <Page {headings} entry={entry} id={entry.id} slug={entry.slug} {...entryMeta} {entryMeta}>
38
41
  <Content />
39
42
  </Page>
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#300](https://github.com/withastro/starlight/pull/300) [`377a25d`](https://github.com/withastro/starlight/commit/377a25dc4c51c060e751aeba4d3f946a41de907a) Thanks [@cbontems](https://github.com/cbontems)! - Fix broken link on 404 page when `defaultLocale: 'root'` is set in `astro.config.mjs`
8
+
9
+ - [#289](https://github.com/withastro/starlight/pull/289) [`dffca46`](https://github.com/withastro/starlight/commit/dffca461633940847e9177913053885c5e8b5f29) Thanks [@RyanRBrown](https://github.com/RyanRBrown)! - Fix saturation of purple text in light theme
10
+
11
+ - [#301](https://github.com/withastro/starlight/pull/301) [`d47639d`](https://github.com/withastro/starlight/commit/d47639d50b53fa691c1d9b0f30f82ebf7f6ddf7e) Thanks [@delucis](https://github.com/delucis)! - Enable inline stylesheets for Astro versions ≥2.6.0
12
+
13
+ ## 0.4.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#259](https://github.com/withastro/starlight/pull/259) [`8102389`](https://github.com/withastro/starlight/commit/810238934ae1a95c53042ca2875bb4033aad0114) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Add support for collapsed sidebar groups
18
+
19
+ - [#254](https://github.com/withastro/starlight/pull/254) [`faa70de`](https://github.com/withastro/starlight/commit/faa70de584bf596fdd7184c4a8622d67d1410ecf) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Expose `<Icon>` component
20
+
21
+ - [#256](https://github.com/withastro/starlight/pull/256) [`048e948`](https://github.com/withastro/starlight/commit/048e948bce650d559517850c73d827733b8164c4) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Add new global `lastUpdated` option defaulting to `false` to define whether or not the last updated date is shown in the footer. A page can override this setting or the generated date using the new `lastUpdated` frontmatter field.
22
+
23
+ ⚠️ Breaking change. Starlight will no longer show this date by default. To keep the previous behavior, you must explicitly set `lastUpdated` to `true` in your configuration.
24
+
25
+ ```diff
26
+ starlight({
27
+ + lastUpdated: true,
28
+ }),
29
+ ```
30
+
31
+ ### Patch Changes
32
+
33
+ - [#264](https://github.com/withastro/starlight/pull/264) [`ed1e46b`](https://github.com/withastro/starlight/commit/ed1e46beb1bc054ecdba36ecfe566ecaeaf8799b) Thanks [@astridx](https://github.com/astridx)! - Add new icon for displaying codeberg.org in social links.
34
+
35
+ - [#260](https://github.com/withastro/starlight/pull/260) [`01b65b1`](https://github.com/withastro/starlight/commit/01b65b1adf012474daf5678b4a709e3a7a484814) Thanks [@ElianCodes](https://github.com/ElianCodes)! - Add Dutch UI translations
36
+
37
+ - [#269](https://github.com/withastro/starlight/pull/269) [`fdc18b5`](https://github.com/withastro/starlight/commit/fdc18b5476957f8017a0fa1489c6fed89d5a9480) Thanks [@baspinarenes](https://github.com/baspinarenes)! - Add Turkish UI translations
38
+
39
+ - [#270](https://github.com/withastro/starlight/pull/270) [`1d3e705`](https://github.com/withastro/starlight/commit/1d3e705256fa0668db73b01c898e7e3b3b505c49) Thanks [@cbontems](https://github.com/cbontems)! - Improve French UI translations
40
+
41
+ - [#272](https://github.com/withastro/starlight/pull/272) [`6b23ebc`](https://github.com/withastro/starlight/commit/6b23ebc9974828837a2de9175297664e5d28a999) Thanks [@cbontems](https://github.com/cbontems)! - Add YouTube social link support
42
+
43
+ - [#267](https://github.com/withastro/starlight/pull/267) [`af2e43c`](https://github.com/withastro/starlight/commit/af2e43c7325a8f7fa6c9f867a3ec864daae39e96) Thanks [@nikcio](https://github.com/nikcio)! - Add Danish UI translations
44
+
45
+ - [#273](https://github.com/withastro/starlight/pull/273) [`d4f5134`](https://github.com/withastro/starlight/commit/d4f5134c91b393ac448efc3f44849fc886a05551) Thanks [@Waxer59](https://github.com/Waxer59)! - Fix typo in Spanish UI translations
46
+
3
47
  ## 0.3.1
4
48
 
5
49
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  ---
2
- import Icon from './Icon.astro';
2
+ import Icon from '../user-components/Icon.astro';
3
3
  import type { Icons } from './Icons';
4
4
 
5
5
  interface Props {
@@ -2,7 +2,7 @@
2
2
  import type { CollectionEntry } from 'astro:content';
3
3
  import config from 'virtual:starlight/user-config';
4
4
  import { useTranslations } from '../utils/translations';
5
- import Icon from './Icon.astro';
5
+ import Icon from '../user-components/Icon.astro';
6
6
 
7
7
  interface Props {
8
8
  data: CollectionEntry<'docs'>['data'];
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  import { useTranslations } from '../utils/translations';
3
- import Icon from './Icon.astro';
3
+ import Icon from '../user-components/Icon.astro';
4
4
 
5
5
  interface Props {
6
6
  locale: string | undefined;
@@ -24,7 +24,20 @@ const prevNextLinks = getPrevNextLinks(sidebar);
24
24
  <EditLink data={entry.data} id={entry.id} {locale} />
25
25
  )
26
26
  }
27
- <LastUpdated id={entry.id} {lang} {locale} />
27
+ {
28
+ (entry.data.lastUpdated ?? config.lastUpdated) && (
29
+ <LastUpdated
30
+ id={entry.id}
31
+ {lang}
32
+ lastUpdated={
33
+ typeof entry.data.lastUpdated !== 'boolean'
34
+ ? entry.data.lastUpdated
35
+ : undefined
36
+ }
37
+ {locale}
38
+ />
39
+ )
40
+ }
28
41
  </div>
29
42
  <PrevNextLinks {...prevNextLinks} {dir} {locale} />
30
43
  </footer>
@@ -60,4 +60,8 @@ export const Icons = {
60
60
  '<path d="M24 4.4a10 10 0 0 1-2.83.78 5.05 5.05 0 0 0 2.17-2.79 9.7 9.7 0 0 1-3.13 1.23 4.89 4.89 0 0 0-5.94-1.03 5 5 0 0 0-2.17 2.38 5.15 5.15 0 0 0-.3 3.25c-1.95-.1-3.86-.63-5.61-1.53a14.04 14.04 0 0 1-4.52-3.74 5.2 5.2 0 0 0-.09 4.91c.39.74.94 1.35 1.61 1.82a4.77 4.77 0 0 1-2.23-.63v.06c0 1.16.4 2.29 1.12 3.18a4.9 4.9 0 0 0 2.84 1.74c-.73.22-1.5.26-2.24.12a4.89 4.89 0 0 0 4.59 3.49A9.78 9.78 0 0 1 0 19.73 13.65 13.65 0 0 0 7.55 22a13.63 13.63 0 0 0 9.96-4.16A14.26 14.26 0 0 0 21.6 7.65V7c.94-.72 1.75-1.6 2.4-2.6Z"/>',
61
61
  mastodon:
62
62
  '<path d="M16.45 17.77c2.77-.33 5.18-2.03 5.49-3.58.47-2.45.44-5.97.44-5.97 0-4.77-3.15-6.17-3.15-6.17-1.58-.72-4.3-1.03-7.13-1.05h-.07c-2.83.02-5.55.33-7.13 1.05 0 0-3.14 1.4-3.14 6.17v.91c-.01.88-.02 1.86 0 2.88.12 4.67.87 9.27 5.2 10.4 2 .53 3.72.64 5.1.57 2.51-.14 3.92-.9 3.92-.9l-.08-1.8s-1.8.56-3.8.5c-2-.08-4.1-.22-4.43-2.66a4.97 4.97 0 0 1-.04-.68s1.96.48 4.44.59c1.51.07 2.94-.09 4.38-.26Zm2.22-3.4h-2.3v-5.6c0-1.19-.5-1.79-1.5-1.79-1.1 0-1.66.71-1.66 2.12v3.07h-2.3V9.1c0-1.4-.55-2.12-1.65-2.12-1 0-1.5.6-1.5 1.78v5.61h-2.3V8.6c0-1.18.3-2.12.9-2.81a3.17 3.17 0 0 1 2.47-1.05c1.18 0 2.07.45 2.66 1.35l.57.96.58-.96a2.97 2.97 0 0 1 2.66-1.35c1.01 0 1.83.36 2.46 1.05.6.7.9 1.63.9 2.81v5.78Z"/>',
63
+ codeberg:
64
+ '<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"/>',
65
+ youtube:
66
+ '<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"/>',
63
67
  };
@@ -8,19 +8,22 @@ import { useTranslations } from '../utils/translations';
8
8
  interface Props {
9
9
  id: CollectionEntry<'docs'>['id'];
10
10
  lang: string;
11
+ lastUpdated: Date | undefined;
11
12
  locale: string | undefined;
12
13
  }
13
14
 
14
- const { id, lang, locale } = Astro.props;
15
+ const { id, lang, lastUpdated, locale } = Astro.props;
15
16
  const t = useTranslations(locale);
16
17
 
17
18
  const currentFilePath = fileURLToPath(
18
19
  new URL('src/content/docs/' + id, project.root)
19
20
  );
20
21
 
21
- let date: Date | undefined;
22
+ let date = lastUpdated;
22
23
  try {
23
- ({ date } = getFileCommitDate(currentFilePath, 'newest'));
24
+ if (!date) {
25
+ ({ date } = getFileCommitDate(currentFilePath, 'newest'));
26
+ }
24
27
  } catch {}
25
28
  ---
26
29
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- import Icon from './Icon.astro';
2
+ import Icon from '../user-components/Icon.astro';
3
3
  import { useTranslations } from '../utils/translations';
4
4
 
5
5
  interface Props {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { Link } from '../utils/navigation';
3
3
  import { useTranslations } from '../utils/translations';
4
- import Icon from './Icon.astro';
4
+ import Icon from '../user-components/Icon.astro';
5
5
 
6
6
  interface Props {
7
7
  prev: Link | undefined;
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import '@pagefind/default-ui/css/ui.css';
3
3
  import { useTranslations } from '../utils/translations';
4
- import Icon from './Icon.astro';
4
+ import Icon from '../user-components/Icon.astro';
5
5
 
6
6
  interface Props {
7
7
  locale: string | undefined;
@@ -1,5 +1,5 @@
1
1
  ---
2
- import Icon from './Icon.astro';
2
+ import Icon from '../user-components/Icon.astro';
3
3
 
4
4
  interface Props {
5
5
  label: string;
@@ -1,6 +1,6 @@
1
1
  ---
2
- import type { SidebarEntry } from '../utils/navigation';
3
- import Icon from './Icon.astro';
2
+ import { flattenSidebar, type SidebarEntry } from '../utils/navigation';
3
+ import Icon from '../user-components/Icon.astro';
4
4
 
5
5
  interface Props {
6
6
  sublist: SidebarEntry[];
@@ -21,7 +21,9 @@ interface Props {
21
21
  {entry.label}
22
22
  </a>
23
23
  ) : (
24
- <details open>
24
+ <details
25
+ open={flattenSidebar(entry.entries).some(i => i.isCurrent) || !entry.collapsed}
26
+ >
25
27
  <summary>
26
28
  <h2 class="large">{entry.label}</h2>
27
29
  <Icon name="right-caret" class="caret" size="1.25rem" />
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  import config from 'virtual:starlight/user-config';
3
- import Icon from './Icon.astro';
3
+ import Icon from '../user-components/Icon.astro';
4
4
 
5
5
  type Platform = keyof NonNullable<typeof config.social>;
6
6
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  import { useTranslations } from '../../utils/translations';
3
- import Icon from '../Icon.astro';
3
+ import Icon from '../../user-components/Icon.astro';
4
4
  import TableOfContentsList from './TableOfContentsList.astro';
5
5
  import type { TocItem } from './generateToC';
6
6
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- import Icon from './Icon.astro';
2
+ import Icon from '../user-components/Icon.astro';
3
3
  ---
4
4
 
5
5
  {/* This is intentionally inlined to avoid FOUC. */}
package/components.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as Card } from './user-components/Card.astro';
2
2
  export { default as CardGrid } from './user-components/CardGrid.astro';
3
+ export { default as Icon } from './user-components/Icon.astro';
3
4
  export { default as Tabs } from './user-components/Tabs.astro';
4
5
  export { default as TabItem } from './user-components/TabItem.astro';
package/index.ts CHANGED
@@ -55,6 +55,7 @@ export default function StarlightIntegration(
55
55
  ? {}
56
56
  : { theme: 'css-variables' },
57
57
  },
58
+ build: { inlineStylesheets: 'auto' },
58
59
  experimental: { assets: true, inlineStylesheets: 'auto' },
59
60
  };
60
61
  updateConfig(newConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^18.15.11",
34
- "astro": "^2.5.0"
34
+ "astro": "^2.7.3"
35
35
  },
36
36
  "dependencies": {
37
37
  "@astrojs/mdx": "^0.19.7",
@@ -47,7 +47,7 @@
47
47
  "unified": "^10.1.2",
48
48
  "unist-util-remove": "^3.1.1",
49
49
  "unist-util-visit": "^4.1.2",
50
- "vfile": "^6.0.0"
50
+ "vfile": "^5.3.7"
51
51
  },
52
52
  "scripts": {}
53
53
  }
package/schema.ts CHANGED
@@ -113,5 +113,11 @@ export function docsSchema() {
113
113
  .default([]),
114
114
  })
115
115
  .optional(),
116
+
117
+ /**
118
+ * The last update date of the current page.
119
+ * Overrides the `lastUpdated` global config or the date generated from the Git history.
120
+ */
121
+ lastUpdated: z.union([z.date(), z.boolean()]).optional(),
116
122
  });
117
123
  }
package/style/props.css CHANGED
@@ -135,7 +135,7 @@
135
135
  --sl-color-blue-high: hsl(var(--sl-hue-blue), 80%, 30%);
136
136
  --sl-color-blue: hsl(var(--sl-hue-blue), 90%, 60%);
137
137
  --sl-color-blue-low: hsl(var(--sl-hue-blue), 88%, 90%);
138
- --sl-color-purple-high: hsl(var(--sl-hue-purple), 39%, 30%);
138
+ --sl-color-purple-high: hsl(var(--sl-hue-purple), 90%, 30%);
139
139
  --sl-color-purple: hsl(var(--sl-hue-purple), 90%, 60%);
140
140
  --sl-color-purple-low: hsl(var(--sl-hue-purple), 80%, 90%);
141
141
  --sl-color-red-high: hsl(var(--sl-hue-red), 80%, 30%);
@@ -0,0 +1,22 @@
1
+ {
2
+ "skipLink.label": "Gå til indhold",
3
+ "search.label": "Søg",
4
+ "search.shortcutLabel": "(Tryk / for at søge)",
5
+ "search.cancelLabel": "Annuller",
6
+ "search.devWarning": "Søgning er kun tilgængeligt i produktions versioner. \nPrøv at bygge siden og forhåndsvis den for at teste det lokalt.",
7
+ "themeSelect.accessibleLabel": "Vælg tema",
8
+ "themeSelect.dark": "Mørk",
9
+ "themeSelect.light": "Lys",
10
+ "themeSelect.auto": "Auto",
11
+ "languageSelect.accessibleLabel": "Vælg sprog",
12
+ "menuButton.accessibleLabel": "Menu",
13
+ "sidebarNav.accessibleLabel": "Hovednavigation",
14
+ "tableOfContents.onThisPage": "På denne side",
15
+ "tableOfContents.overview": "Oversigt",
16
+ "i18n.untranslatedContent": "Dette indhold er ikke tilgængeligt i dit sprog endnu.",
17
+ "page.editLink": "Rediger siden",
18
+ "page.lastUpdated": "Sidst opdateret:",
19
+ "page.previousLink": "Forrige",
20
+ "page.nextLink": "Næste",
21
+ "404.text": "Siden er ikke fundet. Tjek din URL eller prøv søgelinjen."
22
+ }
@@ -18,5 +18,5 @@
18
18
  "page.lastUpdated": "Última actualización:",
19
19
  "page.previousLink": "Página anterior",
20
20
  "page.nextLink": "Siguiente página",
21
- "404.text": "Página no encontrada. Verifique la URL o intente usar la barra de búsqueda."
21
+ "404.text": "Página no encontrada. Verifica la URL o intenta usar la barra de búsqueda."
22
22
  }
@@ -3,20 +3,20 @@
3
3
  "search.label": "Rechercher",
4
4
  "search.shortcutLabel": "(Presser / pour rechercher)",
5
5
  "search.cancelLabel": "Annuler",
6
- "search.devWarning": "Search is only available in production builds. \nTry building and previewing the site to test it out locally.",
6
+ "search.devWarning": "La recherche est disponible uniquement en mode production. \nEssayez de construire puis de prévisualiser votre site pour tester la recherche localement.",
7
7
  "themeSelect.accessibleLabel": "Selectionner le thème",
8
- "themeSelect.dark": "Dark",
9
- "themeSelect.light": "Light",
8
+ "themeSelect.dark": "Sombre",
9
+ "themeSelect.light": "Clair",
10
10
  "themeSelect.auto": "Auto",
11
11
  "languageSelect.accessibleLabel": "Selectionner la langue",
12
12
  "menuButton.accessibleLabel": "Menu",
13
13
  "sidebarNav.accessibleLabel": "principale",
14
14
  "tableOfContents.onThisPage": "Sur cette page",
15
- "tableOfContents.overview": "Vue d'ensemble",
16
- "i18n.untranslatedContent": "Ce contenu n'est pas encore disponible dans votre langue.",
17
- "page.editLink": "Editer la page",
15
+ "tableOfContents.overview": "Vue densemble",
16
+ "i18n.untranslatedContent": "Ce contenu nest pas encore disponible dans votre langue.",
17
+ "page.editLink": "Modifier cette page",
18
18
  "page.lastUpdated": "Dernière mise à jour :",
19
19
  "page.previousLink": "Précédent",
20
20
  "page.nextLink": "Suivant",
21
- "404.text": "Page non trouvée. Vérifiez l'URL ou essayez d'utiliser la barre de recherche."
21
+ "404.text": "Page non trouvée. Vérifiez lURL ou essayez dutiliser la barre de recherche."
22
22
  }
@@ -7,9 +7,15 @@ import ja from './ja.json';
7
7
  import pt from './pt.json';
8
8
  import fr from './fr.json';
9
9
  import it from './it.json';
10
+ import nl from './nl.json';
11
+ import da from './da.json';
12
+ import tr from './tr.json';
10
13
 
11
14
  const { parse } = builtinI18nSchema();
12
15
 
13
16
  export default Object.fromEntries(
14
- Object.entries({ cs, en, es, de, ja, pt, fr, it }).map(([key, dict]) => [key, parse(dict)])
17
+ Object.entries({ cs, en, es, de, ja, pt, fr, it, nl, da, tr }).map(([key, dict]) => [
18
+ key,
19
+ parse(dict),
20
+ ])
15
21
  );
@@ -0,0 +1,22 @@
1
+ {
2
+ "skipLink.label": "Ga naar inhoud",
3
+ "search.label": "Zoeken",
4
+ "search.shortcutLabel": "(Druk op / om te zoeken)",
5
+ "search.cancelLabel": "Annuleren",
6
+ "search.devWarning": "Zoeken is alleen beschikbaar tijdens productie. \nProbeer om de site te builden en er een preview van te bekijken om lokaal te testen.",
7
+ "themeSelect.accessibleLabel": "Selecteer thema",
8
+ "themeSelect.dark": "Donker",
9
+ "themeSelect.light": "Licht",
10
+ "themeSelect.auto": "Auto",
11
+ "languageSelect.accessibleLabel": "Selecteer taal",
12
+ "menuButton.accessibleLabel": "Menu",
13
+ "sidebarNav.accessibleLabel": "Hoofdnavigatie",
14
+ "tableOfContents.onThisPage": "Op deze pagina",
15
+ "tableOfContents.overview": "Overzicht",
16
+ "i18n.untranslatedContent": "Deze inhoud is nog niet vertaald.",
17
+ "page.editLink": "Bewerk pagina",
18
+ "page.lastUpdated": "Laatst bewerkt:",
19
+ "page.previousLink": "Laatste",
20
+ "page.nextLink": "Volgende",
21
+ "404.text": "Pagina niet gevonden. Controleer de URL of probeer de zoekbalk."
22
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "skipLink.label": "İçeriğe geç",
3
+ "search.label": "Ara",
4
+ "search.shortcutLabel": "(Aramak için / bas)",
5
+ "search.cancelLabel": "İptal",
6
+ "search.devWarning": "Arama yalnızca üretim derlemelerinde kullanılabilir. \nYerel bilgisayarınızda test etmek için siteyi derleyin ve önizleme yapın.",
7
+ "themeSelect.accessibleLabel": "Tema seç",
8
+ "themeSelect.dark": "Koyu",
9
+ "themeSelect.light": "Açık",
10
+ "themeSelect.auto": "Otomatik",
11
+ "languageSelect.accessibleLabel": "Dil seçin",
12
+ "menuButton.accessibleLabel": "Menü",
13
+ "sidebarNav.accessibleLabel": "Ana",
14
+ "tableOfContents.onThisPage": "Sayfa içeriği",
15
+ "tableOfContents.overview": "Genel bakış",
16
+ "i18n.untranslatedContent": "Bu içerik henüz dilinizde mevcut değil.",
17
+ "page.editLink": "Sayfayı düzenle",
18
+ "page.lastUpdated": "Son güncelleme:",
19
+ "page.previousLink": "Önceki",
20
+ "page.nextLink": "Sonraki",
21
+ "404.text": "Sayfa bulunamadı. URL'i kontrol edin ya da arama çubuğunu kullanmayı deneyin."
22
+ }
@@ -1,5 +1,5 @@
1
1
  ---
2
- import Icon from '../components/Icon.astro';
2
+ import Icon from './Icon.astro';
3
3
  import type { Icons } from '../components/Icons';
4
4
 
5
5
  interface Props {
@@ -1,5 +1,5 @@
1
1
  ---
2
- import { Icons } from './Icons';
2
+ import { Icons } from '../components/Icons';
3
3
 
4
4
  interface Props {
5
5
  name: keyof typeof Icons;
@@ -21,6 +21,7 @@ interface Group {
21
21
  type: 'group';
22
22
  label: string;
23
23
  entries: (Link | Group)[];
24
+ collapsed: boolean;
24
25
  }
25
26
 
26
27
  export type SidebarEntry = Link | Group;
@@ -53,6 +54,7 @@ function configItemToEntry(
53
54
  entries: item.items.map((i) =>
54
55
  configItemToEntry(i, currentPathname, locale, routes)
55
56
  ),
57
+ collapsed: item.collapsed,
56
58
  };
57
59
  }
58
60
  }
@@ -64,7 +66,7 @@ function groupFromAutogenerateConfig(
64
66
  routes: Route[],
65
67
  currentPathname: string
66
68
  ): Group {
67
- const { directory } = item.autogenerate;
69
+ const { collapsed: subgroupCollapsed, directory } = item.autogenerate;
68
70
  const localeDir = locale ? locale + '/' + directory : directory;
69
71
  const dirDocs = routes.filter(
70
72
  (doc) =>
@@ -77,7 +79,8 @@ function groupFromAutogenerateConfig(
77
79
  return {
78
80
  type: 'group',
79
81
  label: pickLang(item.translations, localeToLang(locale)) || item.label,
80
- entries: sidebarFromDir(tree, currentPathname, locale),
82
+ entries: sidebarFromDir(tree, currentPathname, locale, subgroupCollapsed ?? item.collapsed),
83
+ collapsed: item.collapsed,
81
84
  };
82
85
  }
83
86
 
@@ -168,15 +171,17 @@ function groupFromDir(
168
171
  fullPath: string,
169
172
  dirName: string,
170
173
  currentPathname: string,
171
- locale: string | undefined
174
+ locale: string | undefined,
175
+ collapsed: boolean
172
176
  ): Group {
173
177
  const entries = Object.entries(dir).map(([key, dirOrSlug]) =>
174
- dirToItem(dirOrSlug, `${fullPath}/${key}`, key, currentPathname, locale)
178
+ dirToItem(dirOrSlug, `${fullPath}/${key}`, key, currentPathname, locale, collapsed)
175
179
  );
176
180
  return {
177
181
  type: 'group',
178
182
  label: dirName,
179
183
  entries,
184
+ collapsed,
180
185
  };
181
186
  }
182
187
 
@@ -186,21 +191,23 @@ function dirToItem(
186
191
  fullPath: string,
187
192
  dirName: string,
188
193
  currentPathname: string,
189
- locale: string | undefined
194
+ locale: string | undefined,
195
+ collapsed: boolean
190
196
  ): SidebarEntry {
191
197
  return typeof dirOrSlug === 'string'
192
198
  ? linkFromSlug(dirOrSlug, currentPathname)
193
- : groupFromDir(dirOrSlug, fullPath, dirName, currentPathname, locale);
199
+ : groupFromDir(dirOrSlug, fullPath, dirName, currentPathname, locale, collapsed);
194
200
  }
195
201
 
196
202
  /** Create a sidebar entry for a given content directory. */
197
203
  function sidebarFromDir(
198
204
  tree: Dir,
199
205
  currentPathname: string,
200
- locale: string | undefined
206
+ locale: string | undefined,
207
+ collapsed: boolean
201
208
  ) {
202
209
  return Object.entries(tree).map(([key, dirOrSlug]) =>
203
- dirToItem(dirOrSlug, key, key, currentPathname, locale)
210
+ dirToItem(dirOrSlug, key, key, currentPathname, locale, collapsed)
204
211
  );
205
212
  }
206
213
 
@@ -216,12 +223,12 @@ export function getSidebar(
216
223
  );
217
224
  } else {
218
225
  const tree = treeify(routes, locale || '');
219
- return sidebarFromDir(tree, pathname, locale);
226
+ return sidebarFromDir(tree, pathname, locale, false);
220
227
  }
221
228
  }
222
229
 
223
230
  /** Turn the nested tree structure of a sidebar into a flat list of all the links. */
224
- function flattenSidebar(sidebar: SidebarEntry[]): Link[] {
231
+ export function flattenSidebar(sidebar: SidebarEntry[]): Link[] {
225
232
  return sidebar.flatMap((entry) =>
226
233
  entry.type === 'group' ? flattenSidebar(entry.entries) : entry
227
234
  );
@@ -35,25 +35,35 @@ const SidebarBaseSchema = z.object({
35
35
  translations: z.record(z.string()).default({}),
36
36
  });
37
37
 
38
+ const SidebarGroupSchema = SidebarBaseSchema.extend({
39
+ /** Whether this item should be collapsed by default. */
40
+ collapsed: z.boolean().default(false),
41
+ });
42
+
38
43
  const SidebarLinkItemSchema = SidebarBaseSchema.extend({
39
44
  /** The link to this item’s content. Can be a relative link to local files or the full URL of an external page. */
40
45
  link: z.string(),
41
46
  });
42
47
  export type SidebarLinkItem = z.infer<typeof SidebarLinkItemSchema>;
43
48
 
44
- const AutoSidebarGroupSchema = SidebarBaseSchema.extend({
49
+ const AutoSidebarGroupSchema = SidebarGroupSchema.extend({
45
50
  /** Enable autogenerating a sidebar category from a specific docs directory. */
46
51
  autogenerate: z.object({
47
52
  /** The directory to generate sidebar items for. */
48
53
  directory: z.string(),
54
+ /**
55
+ * Whether the autogenerated subgroups should be collapsed by default.
56
+ * Defaults to the `AutoSidebarGroup` `collapsed` value.
57
+ */
58
+ collapsed: z.boolean().optional(),
49
59
  // TODO: not supported by Docusaurus but would be good to have
50
60
  /** How many directories deep to include from this directory in the sidebar. Default: `Infinity`. */
51
61
  // depth: z.number().optional(),
52
- }),
53
- });
62
+ })
63
+ })
54
64
  export type AutoSidebarGroup = z.infer<typeof AutoSidebarGroupSchema>;
55
65
 
56
- type ManualSidebarGroupInput = z.input<typeof SidebarBaseSchema> & {
66
+ type ManualSidebarGroupInput = z.input<typeof SidebarGroupSchema> & {
57
67
  /** Array of links and subcategories to display in this category. */
58
68
  items: Array<
59
69
  | z.input<typeof SidebarLinkItemSchema>
@@ -62,7 +72,7 @@ type ManualSidebarGroupInput = z.input<typeof SidebarBaseSchema> & {
62
72
  >;
63
73
  };
64
74
 
65
- type ManualSidebarGroupOutput = z.output<typeof SidebarBaseSchema> & {
75
+ type ManualSidebarGroupOutput = z.output<typeof SidebarGroupSchema> & {
66
76
  /** Array of links and subcategories to display in this category. */
67
77
  items: Array<
68
78
  | z.output<typeof SidebarLinkItemSchema>
@@ -75,7 +85,7 @@ const ManualSidebarGroupSchema: z.ZodType<
75
85
  ManualSidebarGroupOutput,
76
86
  z.ZodTypeDef,
77
87
  ManualSidebarGroupInput
78
- > = SidebarBaseSchema.extend({
88
+ > = SidebarGroupSchema.extend({
79
89
  /** Array of links and subcategories to display in this category. */
80
90
  items: z.lazy(() =>
81
91
  z
@@ -86,7 +96,7 @@ const ManualSidebarGroupSchema: z.ZodType<
86
96
  ])
87
97
  .array()
88
98
  ),
89
- });
99
+ })
90
100
 
91
101
  const SidebarItemSchema = z.union([
92
102
  SidebarLinkItemSchema,
@@ -125,6 +135,10 @@ const UserConfigSchema = z.object({
125
135
  github: z.string().url().optional(),
126
136
  /** Link to the Discord server for this site, e.g. `'https://astro.build/chat'`. */
127
137
  discord: z.string().url().optional(),
138
+ /** Link to the Codeberg profile or repository for this site, e.g. `'https://codeberg.org/knut/examples'`. */
139
+ codeberg: z.string().url().optional(),
140
+ /** Link to the Youtube channel for this site, e.g. `'https://www.youtube.com/@astrodotbuild'`. */
141
+ youtube: z.string().url().optional(),
128
142
  })
129
143
  .optional(),
130
144
 
@@ -231,6 +245,14 @@ const UserConfigSchema = z.object({
231
245
  * })
232
246
  */
233
247
  customCss: z.string().array().optional().default([]),
248
+
249
+ /** Define if the last update date should be visible in the page footer. */
250
+ lastUpdated: z
251
+ .boolean()
252
+ .default(false)
253
+ .describe(
254
+ 'Define if the last update date should be visible in the page footer.'
255
+ ),
234
256
  });
235
257
 
236
258
  export const StarlightConfigSchema = UserConfigSchema.strict().transform(