import { defineConfig, fontProviders } from "astro/config";
import sitemap from "@astrojs/sitemap";
import rehypeExternalLinks from "rehype-external-links";
import mdx from "@astrojs/mdx";
import tailwindcss from "@tailwindcss/vite";
import icon from "astro-icon";

// https://astro.build/config
export default defineConfig({
  site: "https://troylusty.com",
  integrations: [sitemap(), mdx(), icon()],
  trailingSlash: "never",
  output: "static",
  vite: {
    plugins: [tailwindcss()],
  },
  markdown: {
    rehypePlugins: [
      [
        rehypeExternalLinks,
        {
          target: "_blank",
        },
      ],
    ],
    shikiConfig: {
      wrap: true,
      themes: {
        light: "github-light-default",
        dark: "github-dark-default",
      },
    },
  },
  redirects: {
    "/archive": "/projects/archive",
    "/cv": "/about",
  },
  image: {
    responsiveStyles: false,
    layout: "constrained",
  },
  experimental: {
    fonts: [
      {
        provider: fontProviders.fontsource(),
        name: "Outfit",
        cssVariable: "--font-outfit",
        weights: ["100 900"],
      },
      {
        provider: fontProviders.fontsource(),
        name: "Red Hat Mono",
        cssVariable: "--font-red-hat-mono",
        weights: ["300 700"],
      },
    ],
  },
});
