Skip to content

Commit 56605a7

Browse files
committed
Add sitemap
1 parent 8e92473 commit 56605a7

5 files changed

Lines changed: 57 additions & 8 deletions

File tree

astro/astro.config.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import react from '@astrojs/react'
55
import tsconfigPaths from 'vite-tsconfig-paths'
66
import {watchAndRun} from 'vite-plugin-watch-and-run'
77

8+
import sitemap from '@astrojs/sitemap';
9+
810
// --- Env-driven switches -----------------------------------
911
const OUTPUT = process.env.ASTRO_OUTPUT === 'static' ? 'static' : 'server'
1012
// "preview" = drafts + stega; "production" = published-only
@@ -34,8 +36,9 @@ export default defineConfig({
3436
// studioUrl: 'http://localhost:3333/production',
3537
}
3638
: false,
37-
}),
38-
react(),
39+
}),
40+
react(),
41+
sitemap()
3942
],
4043
experimental: {
4144
fonts: [
@@ -79,4 +82,4 @@ export default defineConfig({
7982
]),
8083
],
8184
},
82-
})
85+
})

astro/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@
66
"predev": "pnpm run gen:types",
77
"dev": "pnpm run dev:published",
88
"preview": "pnpm run dev:preview",
9-
109
"dev:published": "ASTRO_SITE_MODE=production PUBLIC_SANITY_VISUAL_EDITING_ENABLED=false astro dev",
1110
"dev:preview": "ASTRO_SITE_MODE=preview PUBLIC_SANITY_VISUAL_EDITING_ENABLED=true astro dev",
12-
1311
"build": "pnpm run build:ssg",
1412
"prebuild:ssg": "node scripts/stamp-sw.js",
1513
"build:ssg": "ASTRO_OUTPUT=static ASTRO_SITE_MODE=production PUBLIC_SANITY_VISUAL_EDITING_ENABLED=false astro build",
16-
1714
"prebuild:preview": "node scripts/stamp-sw.js",
1815
"build:preview": "ASTRO_OUTPUT=server ASTRO_SITE_MODE=preview PUBLIC_SANITY_VISUAL_EDITING_ENABLED=true astro build",
19-
2016
"gen:types": "sanity typegen generate",
2117
"astro": "astro",
2218
"dev:preview:local": "ASTRO_SITE_MODE=preview ... astro dev"
@@ -25,6 +21,7 @@
2521
"@astrojs/check": "^0.9.5",
2622
"@astrojs/node": "^9.5.1",
2723
"@astrojs/react": "^4.4.1",
24+
"@astrojs/sitemap": "^3.6.0",
2825
"@portabletext/types": "^3.0.0",
2926
"@sanity/astro": "^3.2.10",
3027
"@sanity/client": "^7.12.1",

astro/public/robots.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
User-agent: *
2-
Allow: /
2+
Allow: /
3+
4+
Sitemap: https://uxmethods.org/sitemap-index.xml

astro/src/components/Head.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const metaDescription =
2020
<meta name="viewport" content="width=device-width" />
2121
<link rel="icon" type="image/svg+xml" href="/icons/favicon.svg" />
2222
<link rel="manifest" href="/manifest.json"/>
23+
<link rel="sitemap" href="/sitemap-index.xml" />
2324
<meta name="generator" content={Astro.generator} />
2425
<title>{pageTitle && pageTitle + " | "} UX Methods | Astro</title>
2526
{robotsNoindex && <meta name="robots" content="noindex,nofollow" />}

pnpm-lock.yaml

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)