@astrojs/starlight 0.3.0 → 0.4.0
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/CHANGELOG.md +42 -0
- package/components/CallToAction.astro +1 -1
- package/components/EditLink.astro +1 -1
- package/components/FallbackContentNotice.astro +1 -1
- package/components/Footer.astro +14 -1
- package/components/Icons.ts +4 -0
- package/components/LastUpdated.astro +6 -3
- package/components/MobileMenuToggle.astro +1 -1
- package/components/PrevNextLinks.astro +1 -1
- package/components/Search.astro +1 -1
- package/components/Select.astro +1 -1
- package/components/SidebarSublist.astro +5 -3
- package/components/SocialIcons.astro +1 -1
- package/components/TableOfContents/MobileTableOfContents.astro +1 -1
- package/components/ThemeProvider.astro +1 -1
- package/components.ts +1 -0
- package/package.json +2 -2
- package/schema.ts +6 -0
- package/translations/cs.json +22 -0
- package/translations/da.json +22 -0
- package/translations/es.json +1 -1
- package/translations/fr.json +7 -7
- package/translations/index.ts +8 -1
- package/translations/nl.json +22 -0
- package/translations/tr.json +22 -0
- package/user-components/Card.astro +1 -1
- package/{components → user-components}/Icon.astro +1 -1
- package/utils/navigation.ts +20 -13
- package/utils/routing.ts +5 -0
- package/utils/slugs.ts +21 -0
- package/utils/user-config.ts +29 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
- [#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
|
|
10
|
+
|
|
11
|
+
- [#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.
|
|
12
|
+
|
|
13
|
+
⚠️ 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.
|
|
14
|
+
|
|
15
|
+
```diff
|
|
16
|
+
starlight({
|
|
17
|
+
+ lastUpdated: true,
|
|
18
|
+
}),
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#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.
|
|
24
|
+
|
|
25
|
+
- [#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
|
|
26
|
+
|
|
27
|
+
- [#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
|
|
28
|
+
|
|
29
|
+
- [#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
|
|
30
|
+
|
|
31
|
+
- [#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
|
|
32
|
+
|
|
33
|
+
- [#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
|
|
34
|
+
|
|
35
|
+
- [#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
|
|
36
|
+
|
|
37
|
+
## 0.3.1
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- [#257](https://github.com/withastro/starlight/pull/257) [`0502327`](https://github.com/withastro/starlight/commit/050232770c8a2d22f317def8e734e4abb36387c6) Thanks [@JosefJezek](https://github.com/JosefJezek)! - Add Czech language support
|
|
42
|
+
|
|
43
|
+
- [#261](https://github.com/withastro/starlight/pull/261) [`2062b9e`](https://github.com/withastro/starlight/commit/2062b9e21695b5dc3f116731dbfdf609e495018c) Thanks [@delucis](https://github.com/delucis)! - Fix autogenerated navigation for pages using fallback content
|
|
44
|
+
|
|
3
45
|
## 0.3.0
|
|
4
46
|
|
|
5
47
|
### Minor Changes
|
|
@@ -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 '
|
|
5
|
+
import Icon from '../user-components/Icon.astro';
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
data: CollectionEntry<'docs'>['data'];
|
package/components/Footer.astro
CHANGED
|
@@ -24,7 +24,20 @@ const prevNextLinks = getPrevNextLinks(sidebar);
|
|
|
24
24
|
<EditLink data={entry.data} id={entry.id} {locale} />
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
|
-
|
|
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>
|
package/components/Icons.ts
CHANGED
|
@@ -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
|
|
22
|
+
let date = lastUpdated;
|
|
22
23
|
try {
|
|
23
|
-
(
|
|
24
|
+
if (!date) {
|
|
25
|
+
({ date } = getFileCommitDate(currentFilePath, 'newest'));
|
|
26
|
+
}
|
|
24
27
|
} catch {}
|
|
25
28
|
---
|
|
26
29
|
|
package/components/Search.astro
CHANGED
package/components/Select.astro
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type
|
|
3
|
-
import Icon from '
|
|
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
|
|
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 { useTranslations } from '../../utils/translations';
|
|
3
|
-
import Icon from '
|
|
3
|
+
import Icon from '../../user-components/Icon.astro';
|
|
4
4
|
import TableOfContentsList from './TableOfContentsList.astro';
|
|
5
5
|
import type { TocItem } from './generateToC';
|
|
6
6
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -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": "^
|
|
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
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skipLink.label": "Přeskočit na obsah",
|
|
3
|
+
"search.label": "Hledat",
|
|
4
|
+
"search.shortcutLabel": "(Vyhledejte stisknutím /)",
|
|
5
|
+
"search.cancelLabel": "Zrušit",
|
|
6
|
+
"search.devWarning": "Vyhledávání je dostupné pouze v produkčních sestaveních. \nZkuste sestavit a zobrazit náhled webu a otestovat jej lokálně.",
|
|
7
|
+
"themeSelect.accessibleLabel": "Vyberte motiv",
|
|
8
|
+
"themeSelect.dark": "Tmavý",
|
|
9
|
+
"themeSelect.light": "Světlý",
|
|
10
|
+
"themeSelect.auto": "Auto",
|
|
11
|
+
"languageSelect.accessibleLabel": "Vyberte jazyk",
|
|
12
|
+
"menuButton.accessibleLabel": "Nabídka",
|
|
13
|
+
"sidebarNav.accessibleLabel": "Hlavní",
|
|
14
|
+
"tableOfContents.onThisPage": "Na této stránce",
|
|
15
|
+
"tableOfContents.overview": "Přehled",
|
|
16
|
+
"i18n.untranslatedContent": "Tento obsah zatím není dostupný ve vašem jazyce.",
|
|
17
|
+
"page.editLink": "Upravit stránku",
|
|
18
|
+
"page.lastUpdated": "Poslední aktualizace:",
|
|
19
|
+
"page.previousLink": "Předchozí",
|
|
20
|
+
"page.nextLink": "Další",
|
|
21
|
+
"404.text": "Stránka nenalezena. Zkontrolujte adresu URL nebo zkuste použít vyhledávací pole."
|
|
22
|
+
}
|
|
@@ -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
|
+
}
|
package/translations/es.json
CHANGED
|
@@ -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.
|
|
21
|
+
"404.text": "Página no encontrada. Verifica la URL o intenta usar la barra de búsqueda."
|
|
22
22
|
}
|
package/translations/fr.json
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
"search.label": "Rechercher",
|
|
4
4
|
"search.shortcutLabel": "(Presser / pour rechercher)",
|
|
5
5
|
"search.cancelLabel": "Annuler",
|
|
6
|
-
"search.devWarning": "
|
|
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": "
|
|
9
|
-
"themeSelect.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
|
|
16
|
-
"i18n.untranslatedContent": "Ce contenu n
|
|
17
|
-
"page.editLink": "
|
|
15
|
+
"tableOfContents.overview": "Vue d’ensemble",
|
|
16
|
+
"i18n.untranslatedContent": "Ce contenu n’est 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
|
|
21
|
+
"404.text": "Page non trouvée. Vérifiez l’URL ou essayez d’utiliser la barre de recherche."
|
|
22
22
|
}
|
package/translations/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { builtinI18nSchema } from '../schemas/i18n';
|
|
2
|
+
import cs from './cs.json';
|
|
2
3
|
import en from './en.json';
|
|
3
4
|
import es from './es.json';
|
|
4
5
|
import de from './de.json';
|
|
@@ -6,9 +7,15 @@ import ja from './ja.json';
|
|
|
6
7
|
import pt from './pt.json';
|
|
7
8
|
import fr from './fr.json';
|
|
8
9
|
import it from './it.json';
|
|
10
|
+
import nl from './nl.json';
|
|
11
|
+
import da from './da.json';
|
|
12
|
+
import tr from './tr.json';
|
|
9
13
|
|
|
10
14
|
const { parse } = builtinI18nSchema();
|
|
11
15
|
|
|
12
16
|
export default Object.fromEntries(
|
|
13
|
-
Object.entries({ en, es, de, ja, pt, fr, it }).map(([key, dict]) => [
|
|
17
|
+
Object.entries({ cs, en, es, de, ja, pt, fr, it, nl, da, tr }).map(([key, dict]) => [
|
|
18
|
+
key,
|
|
19
|
+
parse(dict),
|
|
20
|
+
])
|
|
14
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
|
+
}
|
package/utils/navigation.ts
CHANGED
|
@@ -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,20 +66,21 @@ 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) =>
|
|
71
73
|
// Match against `foo.md` or `foo/index.md`.
|
|
72
|
-
stripExtension(doc.
|
|
74
|
+
stripExtension(doc.id) === localeDir ||
|
|
73
75
|
// Match against `foo/anything/else.md`.
|
|
74
|
-
doc.
|
|
76
|
+
doc.id.startsWith(localeDir + '/')
|
|
75
77
|
);
|
|
76
78
|
const tree = treeify(dirDocs, localeDir);
|
|
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
|
|
|
@@ -136,7 +139,7 @@ function getBreadcrumbs(path: string, baseDir: string): string[] {
|
|
|
136
139
|
function treeify(routes: Route[], baseDir: string): Dir {
|
|
137
140
|
const treeRoot: Dir = {};
|
|
138
141
|
routes.forEach((doc) => {
|
|
139
|
-
const breadcrumbs = getBreadcrumbs(doc.
|
|
142
|
+
const breadcrumbs = getBreadcrumbs(doc.id, baseDir);
|
|
140
143
|
|
|
141
144
|
// Walk down the route’s path to generate the tree.
|
|
142
145
|
let currentDir = treeRoot;
|
|
@@ -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
|
);
|
package/utils/routing.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { CollectionEntry, getCollection } from 'astro:content';
|
|
|
3
3
|
import config from 'virtual:starlight/user-config';
|
|
4
4
|
import {
|
|
5
5
|
LocaleData,
|
|
6
|
+
localizedId,
|
|
6
7
|
localizedSlug,
|
|
7
8
|
slugToLocaleData,
|
|
8
9
|
slugToParam,
|
|
@@ -16,6 +17,7 @@ export interface Route extends LocaleData {
|
|
|
16
17
|
entry: StarlightDocsEntry;
|
|
17
18
|
entryMeta: LocaleData;
|
|
18
19
|
slug: string;
|
|
20
|
+
id: string;
|
|
19
21
|
isFallback?: true;
|
|
20
22
|
[key: string]: unknown;
|
|
21
23
|
}
|
|
@@ -41,6 +43,7 @@ function getRoutes(): Route[] {
|
|
|
41
43
|
const routes: Route[] = docs.map((entry) => ({
|
|
42
44
|
entry,
|
|
43
45
|
slug: entry.slug,
|
|
46
|
+
id: entry.id,
|
|
44
47
|
entryMeta: slugToLocaleData(entry.slug),
|
|
45
48
|
...slugToLocaleData(entry.slug),
|
|
46
49
|
}));
|
|
@@ -61,11 +64,13 @@ function getRoutes(): Route[] {
|
|
|
61
64
|
const localeDocs = getLocaleDocs(locale);
|
|
62
65
|
for (const fallback of defaultLocaleDocs) {
|
|
63
66
|
const slug = localizedSlug(fallback.slug, locale);
|
|
67
|
+
const id = localizedId(fallback.id, locale);
|
|
64
68
|
const doesNotNeedFallback = localeDocs.some((doc) => doc.slug === slug);
|
|
65
69
|
if (doesNotNeedFallback) continue;
|
|
66
70
|
routes.push({
|
|
67
71
|
entry: fallback,
|
|
68
72
|
slug,
|
|
73
|
+
id,
|
|
69
74
|
isFallback: true,
|
|
70
75
|
lang: localeConfig.lang || 'en',
|
|
71
76
|
locale,
|
package/utils/slugs.ts
CHANGED
|
@@ -90,3 +90,24 @@ export function localizedSlug(
|
|
|
90
90
|
}
|
|
91
91
|
return slug ? locale + '/' + slug : locale;
|
|
92
92
|
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Convert a collection entry ID to a different locale.
|
|
96
|
+
* For example, passing an ID of `en/home.md` and a locale of `fr` results in `fr/home.md`.
|
|
97
|
+
* An undefined locale is treated as the root locale, resulting in `home.md`.
|
|
98
|
+
* @param id A collection entry ID
|
|
99
|
+
* @param locale The target locale
|
|
100
|
+
* @example
|
|
101
|
+
* localizedSlug('en/home.md', 'fr') // => 'fr/home.md'
|
|
102
|
+
* localizedSlug('en/home.md', undefined) // => 'home.md'
|
|
103
|
+
*/
|
|
104
|
+
export function localizedId(id: string, locale: string | undefined): string {
|
|
105
|
+
const idLocale = slugToLocale(id);
|
|
106
|
+
if (idLocale) {
|
|
107
|
+
return id.replace(idLocale + '/', locale ? locale + '/' : '');
|
|
108
|
+
} else if (locale) {
|
|
109
|
+
return locale + '/' + id;
|
|
110
|
+
} else {
|
|
111
|
+
return id;
|
|
112
|
+
}
|
|
113
|
+
}
|
package/utils/user-config.ts
CHANGED
|
@@ -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 =
|
|
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
|
|
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
|
|
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
|
-
> =
|
|
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(
|