This page documents the complete Astro configuration used in the portfolio site. The configuration is defined in astro.config.mjs at the project root.
Overview
The Astro configuration sets up server-side rendering with Cloudflare, internationalization, experimental font optimization, environment variables, and integrations for code highlighting and sitemap generation.
// astro.config.mjs location
~/ workspace / source / astro . config . mjs
Core Configuration
Specifies the output mode for the site. Set to "server" to enable server-side rendering (SSR). Value: "server"
adapter
function
default: "cloudflare()"
The deployment adapter for SSR. Uses @astrojs/cloudflare adapter for deploying to Cloudflare Pages/Workers. Value: cloudflare()Import: import cloudflare from '@astrojs/cloudflare'
The public URL of your deployed site. Used for generating canonical URLs and sitemaps. Value: "https://lewiskori.com"
Experimental Features
Experimental font optimization feature that automatically loads and optimizes web fonts. Font provider service. Uses Google Fonts provider.
Font family name: "Inter"
CSS custom property for the font: "--font-inter"
Fallback font stack: ["sans-serif"]
Font display strategy: "swap" (shows fallback font while web font loads)
Environment Variables
Defines type-safe environment variables with validation and context specifications. Show Environment Variable Schema
Beehiiv publication identifier for newsletter integration.
Context: server (server-side only)
Access: secret (treated as sensitive data)
Default: "abc"
API key for Beehiiv newsletter service authentication.
Context: server (server-side only)
Access: secret (treated as sensitive data)
Default: "" (empty string)
Google Tag Manager container ID for analytics tracking.
Context: client (client-side accessible)
Access: public (publicly visible)
Default: "" (empty string)
Internationalization (i18n)
Configuration for multi-language support across the site. Default language for the site: "en" (English)
Supported language codes: ["en", "es", "fr", "de"]
en - English
es - Spanish
fr - French
de - German
routing.prefixDefaultLocale
Whether to prefix default locale in URLs: false When false, English URLs are /about instead of /en/about
Vite Configuration
Vite plugins for build tooling and development server. Plugins:
tailwindcss() - TailwindCSS Vite plugin for styling
Import: import tailwindcss from '@tailwindcss/vite'
Integrations
Expressive Code
Syntax highlighting integration for code blocks with advanced features. Import: import expressiveCode from 'astro-expressive-code'Code block theme: ["aurora-x"] Uses the Aurora X theme for syntax highlighting.
Sitemap
Automatic XML sitemap generation for SEO with custom priority rules. Import: import sitemap from '@astrojs/sitemap'Show Default Configuration
Default change frequency: "weekly"
Last modification date: new Date()
Show Custom Priority Rules
The serialize function customizes sitemap entries based on URL patterns: Homepage (/)
Change frequency: daily
Priority: 1.0
Blog Posts (/blog/[slug]/)
Change frequency: weekly
Priority: 0.8
Main Pages (/about, /contact, /projects, /advisory, /operating-notes)
Change frequency: monthly
Priority: 0.9
Blog Index (/blog/)
Change frequency: daily
Priority: 0.9
Resources (/resources/)
Change frequency: monthly
Priority: 0.6
Complete Configuration
import { defineConfig , envField , fontProviders } from 'astro/config' ;
import tailwindcss from '@tailwindcss/vite' ;
import expressiveCode from 'astro-expressive-code' ;
import sitemap from '@astrojs/sitemap' ;
import cloudflare from '@astrojs/cloudflare' ;
const SITE_URL = 'https://lewiskori.com' ;
export default defineConfig ({
output: 'server' ,
adapter: cloudflare () ,
site: SITE_URL ,
experimental: {
fonts: [
{
provider: fontProviders . google (),
name: 'Inter' ,
cssVariable: '--font-inter' ,
fallbacks: [ 'sans-serif' ],
display: 'swap' ,
},
],
} ,
env: {
schema: {
BEEHIIV_PUBLICATION_ID: envField . string ({
context: 'server' ,
access: 'secret' ,
default: 'abc' ,
}),
BEEHIIV_API_KEY: envField . string ({
context: 'server' ,
access: 'secret' ,
default: '' ,
}),
GTM_ID: envField . string ({
context: 'client' ,
access: 'public' ,
default: '' ,
}),
},
} ,
i18n: {
defaultLocale: 'en' ,
locales: [ 'en' , 'es' , 'fr' , 'de' ],
routing: {
prefixDefaultLocale: false ,
},
} ,
vite: {
plugins: [ tailwindcss ()],
} ,
integrations: [
expressiveCode ({
themes: [ 'aurora-x' ],
}),
sitemap ({
changefreq: 'weekly' ,
priority: 0.7 ,
lastmod: new Date (),
serialize ( item ) {
// Custom priority logic...
},
}),
] ,
}) ;