Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
bentwnghk committed Sep 26, 2024
2 parents 54cea12 + 4711da7 commit 490d91e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
5 changes: 5 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ const nextConfig = {
permanent: true,
source: '/sitemap.xml',
},
{
destination: '/sitemap-index.xml',
permanent: true,
source: '/sitemap-0.xml',
},
{
destination: '/manifest.webmanifest',
permanent: true,
Expand Down
33 changes: 26 additions & 7 deletions src/app/robots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,33 @@ import { MetadataRoute } from 'next';
import { sitemapModule } from '@/server/sitemap';
import { getCanonicalUrl } from '@/server/utils/url';

export default function robots(): MetadataRoute.Robots {
const robots = (): MetadataRoute.Robots => {
return {
host: getCanonicalUrl(),
rules: {
allow: ['/'],
disallow: ['/api/*'],
userAgent: '*',
},
rules: [
{
allow: ['/discover/*'],
disallow: ['/discover/search/*'],
userAgent: ['Facebot', 'facebookexternalhit'],
},
{
allow: ['/discover/*'],
disallow: ['/discover/search/*'],
userAgent: 'LinkedInBot',
},
{
allow: ['/discover/*'],
disallow: ['/discover/search/*'],
userAgent: 'Twitterbot',
},
{
allow: ['/'],
disallow: ['/api/*', '/login', '/signup', '/files', '/repos/*', '/discover/search/*'],
userAgent: '*',
},
],
sitemap: sitemapModule.getRobots(),
};
}
};

export default robots;

0 comments on commit 490d91e

Please sign in to comment.