From 3dedf2169c5cbff451e5e243f5e96c945a5cb27e Mon Sep 17 00:00:00 2001 From: Moinul Moin Date: Fri, 21 Jun 2024 19:34:50 +0600 Subject: [PATCH] fix: :bug: robots.ts, sitemap.ts --- src/app/[locale]/robots.ts | 15 ---------- src/app/[locale]/sitemap.ts | 33 ---------------------- src/app/robots.ts | 15 ++++++++++ src/app/sitemap.ts | 55 +++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 48 deletions(-) delete mode 100644 src/app/[locale]/robots.ts delete mode 100644 src/app/[locale]/sitemap.ts create mode 100644 src/app/robots.ts create mode 100644 src/app/sitemap.ts diff --git a/src/app/[locale]/robots.ts b/src/app/[locale]/robots.ts deleted file mode 100644 index fbeafa9..0000000 --- a/src/app/[locale]/robots.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { type MetadataRoute } from "next"; -import { siteConfig } from "~/config/site"; -import { getCurrentLocale } from "~/locales/server"; - -export default function robots(): MetadataRoute.Robots { - const locale = getCurrentLocale(); - return { - rules: { - userAgent: "*", - allow: "/", - disallow: ["/api/", `/${locale}/dashboard`], - }, - sitemap: [`${siteConfig(locale).url}/sitemap.xml`], - }; -} diff --git a/src/app/[locale]/sitemap.ts b/src/app/[locale]/sitemap.ts deleted file mode 100644 index 996db07..0000000 --- a/src/app/[locale]/sitemap.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { type MetadataRoute } from "next"; -import { siteConfig } from "~/config/site"; -import { getCurrentLocale } from "~/locales/server"; - -export default function sitemap(): MetadataRoute.Sitemap { - const locale = getCurrentLocale(); - return [ - { - url: siteConfig(locale).url, - lastModified: new Date(), - changeFrequency: "weekly", - priority: 1, - }, - { - url: `${siteConfig(locale).url}/login`, - lastModified: new Date(), - changeFrequency: "weekly", - priority: 0.5, - }, - { - url: `${siteConfig(locale).url}/about`, - lastModified: new Date(), - changeFrequency: "weekly", - priority: 0.5, - }, - { - url: `${siteConfig(locale).url}/changelog`, - lastModified: new Date(), - changeFrequency: "weekly", - priority: 0.5, - }, - ]; -} diff --git a/src/app/robots.ts b/src/app/robots.ts new file mode 100644 index 0000000..d7a541c --- /dev/null +++ b/src/app/robots.ts @@ -0,0 +1,15 @@ +import { type MetadataRoute } from "next"; +import { siteUrl } from "~/config/site"; + +export default function robots(): MetadataRoute.Robots { + return { + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/api/", `/dashboard`], + }, + ], + sitemap: `${siteUrl}/sitemap.xml`, + }; +} diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts new file mode 100644 index 0000000..532501b --- /dev/null +++ b/src/app/sitemap.ts @@ -0,0 +1,55 @@ +import { type MetadataRoute } from "next"; +import { siteUrl } from "~/config/site"; + +export default function sitemap(): MetadataRoute.Sitemap { + return [ + { + url: siteUrl, + lastModified: new Date(), + changeFrequency: "weekly", + priority: 1, + alternates: { + languages: { + en: `${siteUrl}/en`, + fr: `${siteUrl}/fr`, + }, + }, + }, + { + url: `${siteUrl}/login`, + lastModified: new Date(), + changeFrequency: "weekly", + priority: 0.5, + alternates: { + languages: { + en: `${siteUrl}/en/login`, + fr: `${siteUrl}/fr/login`, + }, + }, + }, + { + url: `${siteUrl}/about`, + lastModified: new Date(), + changeFrequency: "weekly", + priority: 0.5, + alternates: { + languages: { + en: `${siteUrl}/en/about`, + fr: `${siteUrl}/fr/about`, + }, + }, + }, + { + url: `${siteUrl}/changelog`, + lastModified: new Date(), + changeFrequency: "weekly", + priority: 0.5, + alternates: { + languages: { + en: `${siteUrl}/en/changelog`, + fr: `${siteUrl}/fr/changelog`, + }, + }, + }, + ]; +}