Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/timo-web/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getTranslations, setRequestLocale } from "next-intl/server";

import type { Metadata } from "next";

import { SITE_URL } from "@/constants/site";
import { routing } from "@/i18n/routing";
import { AuthProvider } from "@/providers/auth/AuthProvider";
import { LanguageSyncProvider } from "@/providers/locale/LanguageSyncProvider";
Expand All @@ -19,8 +20,6 @@ const pretendard = localFont({
display: "swap",
});

const SITE_URL = "https://timo.kr";

const OG_LOCALE: Record<(typeof routing.locales)[number], string> = {
en: "en_US",
ko: "ko_KR",
Expand Down
30 changes: 30 additions & 0 deletions apps/timo-web/app/robots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { MetadataRoute } from "next";

import { ROUTES } from "@/constants/routes";
import { SITE_URL } from "@/constants/site";
import { routing } from "@/i18n/routing";

const PRIVATE_ROUTES = [
ROUTES.ONBOARDING,
ROUTES.HOME,
ROUTES.TODAY,
ROUTES.FOCUS,
ROUTES.STATISTICS,
ROUTES.SETTINGS,
] as const;

const disallow = routing.locales.flatMap((locale) => [
...PRIVATE_ROUTES.map((route) => `/${locale}${route}`),
`/${locale}/oauth`,
]);

export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: "*",
allow: "/",
disallow,
},
sitemap: `${SITE_URL}/sitemap.xml`,
};
}
24 changes: 24 additions & 0 deletions apps/timo-web/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { MetadataRoute } from "next";

import { ROUTES } from "@/constants/routes";
import { SITE_URL } from "@/constants/site";
import { routing } from "@/i18n/routing";

const PUBLIC_ROUTES = ["", ROUTES.LOGIN, ROUTES.POLICY] as const;

export default function sitemap(): MetadataRoute.Sitemap {
const lastModified = new Date();

return PUBLIC_ROUTES.map((route) => ({
url: `${SITE_URL}/${routing.defaultLocale}${route}`,
lastModified,
alternates: {
languages: Object.fromEntries(
routing.locales.map((locale) => [
locale,
`${SITE_URL}/${locale}${route}`,
]),
),
},
}));
}
1 change: 1 addition & 0 deletions apps/timo-web/constants/site.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const SITE_URL = "https://timo.kr";
Loading