Skip to content

Commit 9c5951d

Browse files
feat: add robots.ts for SEO optimization with user-agent rules and sitemap configuration
1 parent 699f4e6 commit 9c5951d

2 files changed

Lines changed: 28 additions & 15 deletions

File tree

examples/site/public/robots.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/site/src/app/robots.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { MetadataRoute } from 'next';
2+
3+
const siteUrl = 'https://hiteshshetty-dev.github.io';
4+
const basePath = '/offline-detector';
5+
6+
export const dynamic = 'force-static';
7+
8+
export default function robots(): MetadataRoute.Robots {
9+
const baseUrl = `${siteUrl}${basePath}`;
10+
11+
return {
12+
rules: [
13+
{
14+
userAgent: '*',
15+
allow: '/',
16+
},
17+
{
18+
userAgent: 'Googlebot',
19+
allow: '/',
20+
},
21+
{
22+
userAgent: 'Bingbot',
23+
allow: '/',
24+
},
25+
],
26+
sitemap: `${baseUrl}/sitemap.xml`,
27+
};
28+
}

0 commit comments

Comments
 (0)