hindki/astro.config.mjs
2025-09-23 13:36:33 -07:00

62 lines
1.3 KiB
JavaScript

// @ts-check
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import YAML from "yaml";
import fs from "fs";
const vocabListFile = fs.readFileSync("src/vocab_list.yaml", "utf8");
const vocabListJson = YAML.parse(vocabListFile);
const categories = vocabListJson.map(
(/** @type {{ slug: string }} */ category) => category.slug,
);
const vocabList = [
{
label: "Index",
link: `/vocabulary`,
},
].concat(
categories.map((/** @type {string} */ category) => ({
label: category.charAt(0).toUpperCase() + category.slice(1),
link: `/vocabulary/${category}`,
})),
);
// https://astro.build/config
export default defineConfig({
vite: {
resolve: {
alias: {
"@": "/src",
},
},
},
integrations: [
starlight({
title: "हिंदकी",
customCss: [
// Path to your custom CSS file
"./src/styles/custom.css",
],
sidebar: [
{
label: "Grammar",
autogenerate: { directory: "grammar" },
},
{
label: "Vocabulary",
items: vocabList,
},
{
label: "How I Built This",
autogenerate: { directory: "how-i-built-this" },
},
{
label: "Edit YAML",
link: "/edit",
},
],
}),
],
});