Skip to content

Commit 9a8ec85

Browse files
committed
feat: integrate @astrojs/sitemap to generate and link site index map
1 parent a47800d commit 9a8ec85

File tree

5 files changed

+72
-2
lines changed

5 files changed

+72
-2
lines changed

astro.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
import { defineConfig } from 'astro/config';
33
import tailwindcss from '@tailwindcss/vite';
44
import react from '@astrojs/react';
5+
import sitemap from '@astrojs/sitemap';
56

67
// https://astro.build/config
78
export default defineConfig({
89
output: 'static',
910
site: 'https://mycodingplan.com',
10-
integrations: [react()],
11+
integrations: [react(), sitemap()],
1112
vite: {
1213
plugins: [tailwindcss()]
1314
}

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@astrojs/react": "^5.0.3",
16+
"@astrojs/sitemap": "^3.7.2",
1617
"@tailwindcss/vite": "^4.1.18",
1718
"@types/react": "^19.2.14",
1819
"@types/react-dom": "^19.2.3",

public/robots.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
User-agent: *
22
Allow: /
33

4-
Sitemap: https://mycodingplan.com/sitemap.xml
4+
Sitemap: https://mycodingplan.com/sitemap-index.xml

src/layouts/BaseLayout.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const canonicalURL = new URL(Astro.url.pathname, site);
3434
<meta name="twitter:title" content={title} />
3535
<meta name="twitter:description" content={description} />
3636

37+
<link rel="sitemap" href="/sitemap-index.xml" />
3738
<link rel="preconnect" href="https://fonts.googleapis.com" />
3839
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
3940
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />

0 commit comments

Comments
 (0)