-
Notifications
You must be signed in to change notification settings - Fork 280
/
astro.config.ts
95 lines (87 loc) · 3.05 KB
/
astro.config.ts
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
import { join } from "node:path"
import { fileURLToPath } from "node:url"
import starlight from "@astrojs/starlight"
import { defineConfig } from "astro/config"
import starlightLinksValidator from "starlight-links-validator"
import { loadEnv } from "vite"
import { fixRelativeLinks } from "./remark.js"
const envPath = join(fileURLToPath(import.meta.url), "..")
const env = loadEnv("", envPath, "CUSTOM")
const { CUSTOM_SITE_URL, CUSTOM_REPO_URL } = env
const site = CUSTOM_SITE_URL || "https://docs.cataclysmbn.org"
const github = CUSTOM_REPO_URL || "https://github.com/cataclysmbnteam/Cataclysm-BN"
const itemGuide = "https://cbn-guide.mythoscraft.org"
const discord = "https://discord.gg/XW7XhXuZ89"
const docModes = (dir: string) => [
{ label: "tutorial", autogenerate: { directory: `${dir}/tutorial` } },
{ label: "guides", autogenerate: { directory: `${dir}/guides` } },
{ label: "reference", autogenerate: { directory: `${dir}/reference` } },
{ label: "explanation", autogenerate: { directory: `${dir}/explanation` } },
]
console.log({ ...env, site, github })
export default defineConfig({
site,
redirects: { "/": `./en/` },
markdown: {
remarkPlugins: [fixRelativeLinks],
},
integrations: [
starlightLinksValidator(),
starlight({
title: "Cataclysm: Bright Nights",
defaultLocale: "en",
locales: {
en: { label: "English" },
de: { label: "Deutsch", lang: "de-DE" },
ko: { label: "한국어", lang: "ko-KR" },
ru: { label: "Русский", lang: "ru-RU" },
},
logo: { src: "./src/assets/icon-round.svg" },
social: { github, discord },
/* https://starlight.astro.build/guides/css-and-tailwind/#color-theme-editor */
customCss: [
"./src/styles/theme.css",
"./src/styles/capitalize.css",
],
editLink: { baseUrl: `${github}/edit/main/doc` },
lastUpdated: true,
navbar: {
game: {
label: "Play",
link: "/game/new_player_guide",
translations: { "ko-KR": "게임 가이드" },
items: [{ label: "Game Guides", autogenerate: { directory: "game" } }],
},
mod: {
label: "Mod",
link: "/mod/json/tutorial/modding",
translations: { "ko-KR": "모딩" },
items: [
{ label: "JSON", items: docModes("mod/json") },
{ label: "Lua", items: docModes("mod/lua") },
],
},
dev: {
label: "Develop",
link: "/dev/guides/building/cmake",
translations: { "ko-KR": "게임 개발" },
items: docModes("dev"),
},
"i18n": {
label: "I18n",
link: "/i18n/tutorial/transifex",
translations: { "ko-KR": "번역" },
items: docModes("i18n"),
},
contribute: {
label: "Contribute",
link: "/contribute/contributing",
translations: { "ko-KR": "기여하기" },
items: [
{ label: "Contributing", autogenerate: { directory: "contribute" } },
],
},
},
}),
],
})