TenantAtlas/apps/website/astro.config.mjs

123 lines
3.5 KiB
JavaScript

import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
import sitemap from '@astrojs/sitemap';
import starlight from '@astrojs/starlight';
import mdx from '@astrojs/mdx';
const redirectOnlyPaths = new Set([
'/product/',
'/products/',
'/services/',
'/blog/',
'/insights/',
]);
const isRedirectOnlySitemapPath = page => {
const pathname = page.startsWith('http') ? new URL(page).pathname : page;
const normalized = pathname.endsWith('/') ? pathname : `${pathname}/`;
return redirectOnlyPaths.has(normalized);
};
// https://astro.build/config
export default defineConfig({
devToolbar: {
enabled: false,
},
// https://docs.astro.build/en/guides/images/#authorizing-remote-images
site: process.env.PUBLIC_SITE_URL ?? 'https://tenantial.com',
image: {
domains: ['images.unsplash.com'],
},
// i18n: {
// defaultLocale: "en",
// locales: ["en", "fr"],
// fallback: {
// fr: "en",
// },
// routing: {
// prefixDefaultLocale: false,
// },
// },
prefetch: true,
integrations: [
sitemap({
filter: page => !isRedirectOnlySitemapPath(page),
i18n: {
defaultLocale: 'en',
locales: {
en: 'en',
},
},
}),
starlight({
title: 'Tenantial Docs',
// https://github.com/withastro/starlight/blob/main/packages/starlight/CHANGELOG.md
// If no Astro and Starlight i18n configurations are provided, the built-in default locale is used in Starlight and a matching Astro i18n configuration is generated/used.
// If only a Starlight i18n configuration is provided, an equivalent Astro i18n configuration is generated/used.
// If only an Astro i18n configuration is provided, the Starlight i18n configuration is updated to match it.
// If both an Astro and Starlight i18n configurations are provided, an error is thrown.
locales: {
root: {
label: 'English',
lang: 'en',
},
},
// https://starlight.astro.build/guides/sidebar/
sidebar: [
{
label: 'Evaluation Guides',
translations: {
de: 'Schnellstartanleitungen',
es: 'Guías de Inicio Rápido',
fa: 'راهنمای شروع سریع',
fr: 'Guides de Démarrage Rapide',
ja: 'クイックスタートガイド',
'zh-cn': '快速入门指南',
},
items: [{ autogenerate: { directory: 'guides' } }],
},
{
label: 'Platform Notes',
items: [{ label: 'Evidence Review', link: 'platform/evidence-review/' }],
},
],
social: [],
disable404Route: true,
customCss: ['./src/assets/styles/starlight.css'],
favicon: '/favicon.ico',
components: {
SiteTitle: './src/components/ui/starlight/SiteTitle.astro',
Head: './src/components/ui/starlight/Head.astro',
MobileMenuFooter:
'./src/components/ui/starlight/MobileMenuFooter.astro',
ThemeSelect: './src/components/ui/starlight/ThemeSelect.astro',
},
head: [
{
tag: 'meta',
attrs: {
property: 'og:image',
content: 'https://tenantial.com' + '/social.webp',
},
},
{
tag: 'meta',
attrs: {
property: 'twitter:image',
content: 'https://tenantial.com' + '/social.webp',
},
},
],
}),
mdx(),
],
experimental: {
clientPrerender: true,
},
vite: {
plugins: [tailwindcss()],
},
});