Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

Add sitemap (#706)

Sean Boult35b4cb1283f5
diff --git a/.npmrc b/.npmrc
index 3b5608b8..9b6c4072 100644
--- a/.npmrc
+++ b/.npmrc
@@ -1,4 +1,5 @@
public-hoist-pattern[]=*prisma*
auto-install-peers=true
legacy-peer-deps=true
-node-linker=hoisted
\ No newline at end of file
+node-linker=hoisted
+enable-pre-post-scripts=true
diff --git a/apps/web/public/robots.txt b/apps/web/public/robots.txt
new file mode 100644
index 00000000..d141a322
--- /dev/null
+++ b/apps/web/public/robots.txt
@@ -0,0 +1,9 @@
+# *
+User-agent: *
+Allow: /
+
+# Host
+Host: https://typehero.dev
+
+# Sitemaps
+Sitemap: https://typehero.dev/sitemap.xml
diff --git a/apps/web/src/app/robots.ts b/apps/web/src/app/robots.ts
index 3ca175c9..714ad482 100644
--- a/apps/web/src/app/robots.ts
+++ b/apps/web/src/app/robots.ts
@@ -4,10 +4,8 @@ export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
- allow: '/api/og/*',
- disallow: '/private/',
+ disallow: ['/api/*'],
},
- // TODO: add a sitemap
- // sitemap: 'https://typehero.dev/sitemap.xml',
+ sitemap: '/sitemap.xml',
};
}
diff --git a/apps/web/src/app/sitemap.ts b/apps/web/src/app/sitemap.ts
new file mode 100644
index 00000000..d8c5419c
--- /dev/null
+++ b/apps/web/src/app/sitemap.ts
@@ -0,0 +1,25 @@
+import type { MetadataRoute } from 'next';
+
+const URL = 'https://typehero.dev';
+export default function sitemap(): MetadataRoute.Sitemap {
+ return [
+ {
+ url: `${URL}/`,
+ lastModified: new Date(),
+ changeFrequency: 'monthly',
+ priority: 1,
+ },
+ {
+ url: `${URL}/challenge`,
+ lastModified: new Date(),
+ changeFrequency: 'weekly',
+ priority: 0.8,
+ },
+ {
+ url: `${URL}/tracks`,
+ lastModified: new Date(),
+ changeFrequency: 'weekly',
+ priority: 0.5,
+ },
+ ];
+}