-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
47 lines (45 loc) · 2.05 KB
/
Copy pathastro.config.mjs
File metadata and controls
47 lines (45 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
// Absolute site URL is required for canonical/hreflang/OG tags and the
// generated sitemap. Override via the PUBLIC_SITE_URL environment variable
// per environment (local, deploy preview, production).
const siteUrl = process.env.PUBLIC_SITE_URL ?? 'https://matecode.dev';
export default defineConfig({
site: siteUrl,
output: 'static',
trailingSlash: 'never',
build: {
// Emit `dist/en.html` instead of `dist/en/index.html`. With the default
// directory format, Netlify's Pretty URLs sees a directory and issues a
// `301 /en -> /en/`, which contradicts `trailingSlash: 'never'`: the
// sitemap and canonical both declare the slash-less `/en`, so a crawler
// fetching it is redirected to a page whose canonical points back at the
// redirecting URL. File format serves `/en` directly with a 200 and keeps
// canonical, sitemap, and hosting in agreement.
format: 'file',
},
integrations: [
sitemap({
// File-based i18n (design.md "Decision: File-based i18n, no /es"):
// `/` (no prefix) is the default locale and gets its own hreflang
// alternates alongside `/en/*` — see specs/seo-geo/spec.md
// "Localized Sitemap and Robots".
// Generic language codes, deliberately not region-qualified. `es-ES`
// targets Spain alone, which excludes the Latin American audience this
// site is written for, and it contradicts the plain `hreflang="es"` the
// pages themselves declare in BaseLayout. Two conflicting codes for one
// cluster leave Google without a clean locale match.
i18n: {
defaultLocale: 'es',
locales: {
es: 'es',
en: 'en',
},
},
// Excludes the Netlify Forms confirmation pages from the sitemap —
// they are transactional, not marketing routes, and are already
// excluded from indexing via BaseLayout's `noindex` prop.
filter: (page) => !page.includes('/gracias') && !page.includes('/thank-you'),
}),
],
});