-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.ts
More file actions
108 lines (101 loc) · 3.9 KB
/
astro.config.ts
File metadata and controls
108 lines (101 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import starlightFullViewMode from 'starlight-fullview-mode';
import starlightLinksValidator from 'starlight-links-validator';
import react from '@astrojs/react';
import starlightImageZoom from 'starlight-image-zoom';
import icon from 'astro-icon';
import { NAV_GROUPS, type NavSidebarAutogenerate, type NavSidebarEntry, type NavSidebarGroupItem, type NavSidebarLink } from './navigation.config';
import type { StarlightUserConfig } from '@astrojs/starlight/types';
import reverseDateSidebar from './src/plugins/reverseDateSidebar';
import removeTocOverview from './src/plugins/removeTocOverview';
import remarkAccessibleTaskLists from './src/plugins/remarkAccessibleTaskLists';
import remarkCenterLayoutImages from './src/plugins/remarkCenterLayoutImages';
type SidebarItem = NonNullable<StarlightUserConfig['sidebar']>[number];
const mapAutogenerateEntry = (entry: NavSidebarAutogenerate): SidebarItem => ({
label: entry.label,
collapsed: entry.collapsed ?? true,
autogenerate: { directory: entry.directory },
});
const mapLinkEntry = (entry: NavSidebarLink): SidebarItem => ({
label: entry.label,
link: entry.link,
});
const mapGroupItem = (item: NavSidebarGroupItem): SidebarItem => {
switch (item.kind) {
case 'autogenerate':
return mapAutogenerateEntry(item);
case 'link':
return mapLinkEntry(item);
}
};
const mapSidebarEntry = (entry: NavSidebarEntry): SidebarItem => {
switch (entry.kind) {
case 'autogenerate':
return mapAutogenerateEntry(entry);
case 'group':
return {
label: entry.label,
collapsed: entry.collapsed ?? true,
items: Array.from(entry.items, mapGroupItem),
};
case 'link':
return mapLinkEntry(entry);
}
};
const starlightSidebar: StarlightUserConfig['sidebar'] = NAV_GROUPS.flatMap((group) =>
group.sidebar.map(mapSidebarEntry),
);
export default defineConfig({
site: 'https://gin.btaa.org',
markdown: {
remarkPlugins: [remarkAccessibleTaskLists, remarkCenterLayoutImages],
},
redirects: {
'/updates/': '/blog/',
'/policies/harmful-language': '/library/harmful-language',
'/policies/collection-development': '/library/collection-development',
'/citation': '/guides/data-cite/',
'/mapgallery': '/conference/map-gallery/',
},
integrations: [
starlight({
title: 'BTAA-GIN',
favicon: 'favicon.ico',
logo: {
src: '/src/assets/images/btaa-gin-logo.svg',
alt: 'BTAA-GIN Logo',
replacesTitle: true,
},
head: [
{ tag: 'meta', attrs: { property: 'og:site_name', content: 'BTAA-GIN' } },
{ tag: 'meta', attrs: { property: 'og:type', content: 'website' } },
{ tag: 'meta', attrs: { name: 'twitter:card', content: 'summary_large_image' } },
{ tag: 'meta', attrs: { property: 'og:image', content: 'https://gin.btaa.org/assets/og/default.png' } },
{ tag: 'meta', attrs: { name: 'twitter:image', content: 'https://gin.btaa.org/assets/og/default.png' } },
],
social: [
{ icon: 'email', label: 'Contact', href: 'https://geo.btaa.org/feedback' },
{ icon: 'github', label: 'GitHub', href: 'https://github.com/geobtaa' },
],
customCss: ['./src/styles/global.css', './src/styles/tables.css'],
components: {
// Footer: './src/components/FooterWithBar.astro',
Header: './src/components/Header.astro',
Sidebar: './src/components/SidebarWithFilters.astro',
PageTitle: './src/components/PageTitleWithMeta.astro',
},
plugins: [
starlightImageZoom(),
starlightFullViewMode({leftSidebarEnabled: false} ),
starlightLinksValidator(),
reverseDateSidebar(),
removeTocOverview(),
// starlightTocOverviewCustomizer({overviewTitle: "Back to top",})
],
sidebar: starlightSidebar,
}),
react(),
icon(),
],
});