From 2bd94474cd73c0c306c26442418e0760bcf067bd Mon Sep 17 00:00:00 2001 From: isra el Date: Mon, 6 Jan 2025 06:18:05 +0300 Subject: [PATCH] chore(web): add robots and sitemap --- web/app/robots.ts | 12 ++++++++ web/app/sitemap.ts | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 web/app/robots.ts create mode 100644 web/app/sitemap.ts diff --git a/web/app/robots.ts b/web/app/robots.ts new file mode 100644 index 0000000..664dce7 --- /dev/null +++ b/web/app/robots.ts @@ -0,0 +1,12 @@ +import { MetadataRoute } from 'next' + +export default function robots(): MetadataRoute.Robots { + return { + rules: { + userAgent: '*', + allow: '/', + disallow: ['/dashboard/', '/api/'], + }, + sitemap: `${process.env.NEXT_PUBLIC_SITE_URL}/sitemap.xml`, + } +} diff --git a/web/app/sitemap.ts b/web/app/sitemap.ts new file mode 100644 index 0000000..58e7eb7 --- /dev/null +++ b/web/app/sitemap.ts @@ -0,0 +1,75 @@ +import { MetadataRoute } from 'next' +import { Routes } from '@/config/routes' + +export default function sitemap(): MetadataRoute.Sitemap { + const baseUrl = process.env.NEXT_PUBLIC_SITE_URL + + if (!baseUrl?.includes('textbee.dev')) { + return [] + } + + const routes = [ + { + url: baseUrl, + lastModified: new Date(), + changeFrequency: 'monthly' as const, + priority: 1, + }, + { + url: `${baseUrl}${Routes.login}`, + lastModified: new Date(), + changeFrequency: 'monthly' as const, + priority: 0.8, + }, + { + url: `${baseUrl}${Routes.register}`, + lastModified: new Date(), + changeFrequency: 'monthly' as const, + priority: 0.8, + }, + { + url: `${baseUrl}${Routes.dashboard}`, + lastModified: new Date(), + changeFrequency: 'weekly' as const, + priority: 0.9, + }, + { + url: `${baseUrl}${Routes.contribute}`, + lastModified: new Date(), + changeFrequency: 'monthly' as const, + priority: 0.7, + }, + // { + // url: `${baseUrl}/pricing`, + // lastModified: new Date(), + // changeFrequency: 'monthly' as const, + // priority: 0.8, + // }, + // { + // url: `${baseUrl}/docs`, + // lastModified: new Date(), + // changeFrequency: 'weekly' as const, + // priority: 0.9, + // }, + // { + // url: `${baseUrl}/blog`, + // lastModified: new Date(), + // changeFrequency: 'weekly' as const, + // priority: 0.7, + // }, + // { + // url: `${baseUrl}/privacy`, + // lastModified: new Date(), + // changeFrequency: 'yearly' as const, + // priority: 0.5, + // }, + // { + // url: `${baseUrl}/terms`, + // lastModified: new Date(), + // changeFrequency: 'yearly' as const, + // priority: 0.5, + // }, + ] + + return routes +}