Skip to content

Commit a9af4c2

Browse files
authored
Merge pull request #8 from cse23-mora/sitemap
chore: add sitemap generation logic
2 parents acccd8b + 81e7132 commit a9af4c2

5 files changed

Lines changed: 77 additions & 1 deletion

File tree

astro.config.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
import { defineConfig } from 'astro/config';
33
import remarkMath from 'remark-math';
44
import rehypeMathJax from 'rehype-mathjax';
5+
import sitemap from '@astrojs/sitemap';
56

67
// https://astro.build/config
78
export default defineConfig({
9+
site: 'https://learn.cse23.org', // Replace with your actual domain
810
markdown: {
911
remarkPlugins: [remarkMath],
1012
rehypePlugins: [rehypeMathJax],
1113
},
12-
integrations: [],
14+
integrations: [sitemap()],
1315
});

package-lock.json

Lines changed: 64 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
@@ -10,6 +10,7 @@
1010
"astro": "astro"
1111
},
1212
"dependencies": {
13+
"@astrojs/sitemap": "^3.4.2",
1314
"astro": "^5.6.1",
1415
"rehype-mathjax": "^7.1.0",
1516
"remark-math": "^6.0.0",

public/robots.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
User-agent: *
2+
Allow: /
3+
4+
# Sitemap location
5+
Sitemap: https://learn.cse23.org/sitemap-index.xml
6+
7+
# Block crawling of API endpoints since they're duplicates of lesson pages
8+
Disallow: /api/

src/layouts/Layout.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const { title } = Astro.props;
1313
<meta name="description" content="Educational content hub for CSE23 students" />
1414
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1515
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
16+
<link rel="sitemap" href="/sitemap-index.xml" />
1617
<meta name="generator" content={Astro.generator} />
1718
<title>{title}</title>
1819
</head>

0 commit comments

Comments
 (0)