|
| 1 | +import { defineConfig } from 'astro/config'; |
| 2 | +import starlight from '@astrojs/starlight'; |
| 3 | + |
| 4 | +// https://astro.build/config |
| 5 | +export default defineConfig({ |
| 6 | + site: 'https://echo.labstack.com', |
| 7 | + integrations: [ |
| 8 | + starlight({ |
| 9 | + title: 'Echo', |
| 10 | + logo: { |
| 11 | + light: './src/assets/logo-light.svg', |
| 12 | + dark: './src/assets/logo-dark.svg', |
| 13 | + replacesTitle: true, |
| 14 | + }, |
| 15 | + customCss: ['./src/styles/terminal.css'], |
| 16 | + social: [ |
| 17 | + { icon: 'github', label: 'GitHub', href: 'https://github.com/labstack/echo' }, |
| 18 | + ], |
| 19 | + editLink: { |
| 20 | + baseUrl: 'https://github.com/labstack/echox/edit/master/website/', |
| 21 | + }, |
| 22 | + lastUpdated: true, |
| 23 | + // Echo "E" cube mark; .ico kept as legacy fallback, apple-touch-icon added in head. |
| 24 | + favicon: '/favicon.svg', |
| 25 | + // Keep Starlight's built-in Pagefind ⌘K search; add Ask Echo + DocActions via overrides. |
| 26 | + components: { |
| 27 | + Footer: './src/components/Footer.astro', |
| 28 | + PageTitle: './src/components/PageTitle.astro', |
| 29 | + }, |
| 30 | + head: [ |
| 31 | + // Dark-first: default new visitors to dark unless they've chosen otherwise. |
| 32 | + { |
| 33 | + tag: 'script', |
| 34 | + content: "if(!localStorage.getItem('starlight-theme')){localStorage.setItem('starlight-theme','dark');document.documentElement.dataset.theme='dark';}", |
| 35 | + }, |
| 36 | + { tag: 'link', attrs: { rel: 'preconnect', href: 'https://fonts.googleapis.com' } }, |
| 37 | + { tag: 'link', attrs: { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: true } }, |
| 38 | + { |
| 39 | + tag: 'link', |
| 40 | + attrs: { |
| 41 | + rel: 'stylesheet', |
| 42 | + href: 'https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Fragment+Mono&display=swap', |
| 43 | + }, |
| 44 | + }, |
| 45 | + { |
| 46 | + tag: 'link', |
| 47 | + attrs: { |
| 48 | + rel: 'stylesheet', |
| 49 | + href: 'https://unpkg.com/@phosphor-icons/web@2.1.1/src/regular/style.css', |
| 50 | + }, |
| 51 | + }, |
| 52 | + // Default social card. Starlight already emits og:title/description/url |
| 53 | + // and twitter:card=summary_large_image, but no image — add a site-wide |
| 54 | + // default so shares aren't imageless. Absolute URLs are required by |
| 55 | + // social scrapers. Per-page overrides can set their own og:image later. |
| 56 | + { tag: 'meta', attrs: { property: 'og:image', content: 'https://echo.labstack.com/og.png' } }, |
| 57 | + { tag: 'meta', attrs: { property: 'og:image:width', content: '1200' } }, |
| 58 | + { tag: 'meta', attrs: { property: 'og:image:height', content: '630' } }, |
| 59 | + { tag: 'meta', attrs: { name: 'twitter:image', content: 'https://echo.labstack.com/og.png' } }, |
| 60 | + { tag: 'link', attrs: { rel: 'apple-touch-icon', href: '/apple-touch-icon.png' } }, |
| 61 | + ], |
| 62 | + // Autogenerated from the content dirs — new pages appear automatically, |
| 63 | + // ordered by each page's `sidebar.order` frontmatter. |
| 64 | + sidebar: [ |
| 65 | + { label: 'Guide', items: [{ autogenerate: { directory: 'guide' } }] }, |
| 66 | + { label: 'Middleware', items: [{ autogenerate: { directory: 'middleware' } }] }, |
| 67 | + { label: 'Cookbook', items: [{ autogenerate: { directory: 'cookbook' } }] }, |
| 68 | + ], |
| 69 | + // tune the built-in code theme toward our terminal palette |
| 70 | + expressiveCode: { themes: ['github-dark', 'github-light'] }, |
| 71 | + }), |
| 72 | + ], |
| 73 | +}); |
0 commit comments