-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
80 lines (78 loc) · 2.53 KB
/
astro.config.mjs
File metadata and controls
80 lines (78 loc) · 2.53 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
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
const githubOwner =
process.env.GITHUB_REPOSITORY_OWNER ?? process.env.GITHUB_REPOSITORY?.split('/')[0];
const githubRepository = process.env.GITHUB_REPOSITORY?.split('/')[1];
const repositoryUrl =
githubOwner && githubRepository
? `https://github.com/${githubOwner}/${githubRepository}`
: 'https://github.com/DePasqualeOrg/rust-for-swift-developers';
const isUserPagesRepository =
githubOwner &&
githubRepository &&
githubRepository.toLowerCase() === `${githubOwner.toLowerCase()}.github.io`;
export default defineConfig({
// Override these for a custom domain or non-standard Pages URL.
site: process.env.SITE_URL ?? (githubOwner ? `https://${githubOwner}.github.io` : 'http://localhost:4321'),
base:
process.env.BASE_PATH ??
(githubRepository && !isUserPagesRepository ? `/${githubRepository}` : '/'),
integrations: [
starlight({
title: 'Rust for Swift Developers',
disable404Route: true,
customCss: ['./src/styles/starlight.css'],
social: [{ icon: 'github', label: 'GitHub', href: repositoryUrl }],
sidebar: [
{
label: 'Introduction',
link: '/',
},
{
label: 'Getting Started',
autogenerate: { directory: 'getting-started' },
},
{
label: 'Language Fundamentals',
autogenerate: { directory: 'language-fundamentals' },
},
{
label: 'The Ownership System',
autogenerate: { directory: 'ownership-system' },
},
{
label: 'Abstraction and Composition',
autogenerate: { directory: 'abstraction-and-composition' },
},
{
label: 'Error Handling',
autogenerate: { directory: 'error-handling' },
},
{
label: 'Memory and Smart Pointers',
autogenerate: { directory: 'memory-and-smart-pointers' },
},
{
label: 'Concurrency',
autogenerate: { directory: 'concurrency' },
},
{
label: 'The Rust Ecosystem',
autogenerate: { directory: 'rust-ecosystem' },
},
{
label: 'Interop and FFI',
autogenerate: { directory: 'interop-and-ffi' },
},
{
label: 'Rust and WebAssembly',
autogenerate: { directory: 'rust-and-webassembly' },
},
{
label: 'Appendices',
autogenerate: { directory: 'appendices' },
},
],
}),
],
});