|
| 1 | +import mdx from "@astrojs/mdx"; |
| 2 | +import react from "@astrojs/react"; |
| 3 | +import sitemap from "@astrojs/sitemap"; |
| 4 | +import tailwind from "@astrojs/tailwind"; |
| 5 | +import AutoImport from "astro-auto-import"; |
| 6 | +import { defineConfig, squooshImageService } from "astro/config"; |
| 7 | +import remarkCollapse from "remark-collapse"; |
| 8 | +import remarkToc from "remark-toc"; |
| 9 | +import config from "./src/config/config.json"; |
| 10 | +import languagesJSON from "./src/config/language.json"; |
| 11 | +const { default_language } = config.settings; |
| 12 | + |
| 13 | +const supportedLang = [...languagesJSON.map((lang) => lang.languageCode)]; |
| 14 | +const disabledLanguages = config.settings.disable_languages; |
| 15 | + |
| 16 | +// Filter out disabled languages from supportedLang |
| 17 | +const filteredSupportedLang = supportedLang.filter( |
| 18 | + (lang) => !disabledLanguages.includes(lang), |
| 19 | +); |
| 20 | + |
| 21 | +// https://astro.build/config |
| 22 | +export default defineConfig({ |
| 23 | + site: config.site.base_url ? config.site.base_url : "http://examplesite.com", |
| 24 | + base: config.site.base_path ? config.site.base_path : "/", |
| 25 | + trailingSlash: config.site.trailing_slash ? "always" : "ignore", |
| 26 | + i18n: { |
| 27 | + locales: filteredSupportedLang, |
| 28 | + defaultLocale: default_language, |
| 29 | + }, |
| 30 | + image: { |
| 31 | + service: squooshImageService(), |
| 32 | + }, |
| 33 | + integrations: [ |
| 34 | + react(), |
| 35 | + sitemap(), |
| 36 | + tailwind({ |
| 37 | + applyBaseStyles: false, |
| 38 | + }), |
| 39 | + AutoImport({ |
| 40 | + imports: [ |
| 41 | + "@/shortcodes/Button", |
| 42 | + "@/shortcodes/Accordion", |
| 43 | + "@/shortcodes/Notice", |
| 44 | + "@/shortcodes/Video", |
| 45 | + "@/shortcodes/Youtube", |
| 46 | + "@/shortcodes/Tabs", |
| 47 | + "@/shortcodes/Tab", |
| 48 | + ], |
| 49 | + }), |
| 50 | + mdx(), |
| 51 | + ], |
| 52 | + markdown: { |
| 53 | + remarkPlugins: [ |
| 54 | + remarkToc, |
| 55 | + [ |
| 56 | + remarkCollapse, |
| 57 | + { |
| 58 | + test: "Table of contents", |
| 59 | + }, |
| 60 | + ], |
| 61 | + ], |
| 62 | + shikiConfig: { |
| 63 | + theme: "one-dark-pro", |
| 64 | + wrap: true, |
| 65 | + }, |
| 66 | + extendDefaultPlugins: true, |
| 67 | + }, |
| 68 | +}); |
0 commit comments