diff options
Diffstat (limited to 'apps/web')
| -rw-r--r-- | apps/web/package.json | 2 | ||||
| -rw-r--r-- | apps/web/src/app/robots.ts | 13 | ||||
| -rw-r--r-- | apps/web/src/app/sitemap.ts | 61 | ||||
| -rw-r--r-- | apps/web/src/constants/site.ts | 1 |
4 files changed, 76 insertions, 1 deletions
diff --git a/apps/web/package.json b/apps/web/package.json index 1d16576e..f5cd7da4 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -43,7 +43,7 @@ "input-otp": "^1.4.1", "lucide-react": "^0.468.0", "motion": "^12.18.1", - "next": "^15.4.1", + "next": "^15.4.3", "next-themes": "^0.4.4", "pg": "^8.16.2", "radix-ui": "^1.4.2", diff --git a/apps/web/src/app/robots.ts b/apps/web/src/app/robots.ts new file mode 100644 index 00000000..ad6c31c8 --- /dev/null +++ b/apps/web/src/app/robots.ts @@ -0,0 +1,13 @@ +import type { MetadataRoute } from "next"; +import { SITE_URL } from "@/constants/site"; + +export default function robots(): MetadataRoute.Robots { + return { + rules: { + userAgent: "*", + allow: "/", + disallow: ["/_next/", "/projects/", "/editor/"], + }, + sitemap: `${SITE_URL}/sitemap.xml`, + }; +} diff --git a/apps/web/src/app/sitemap.ts b/apps/web/src/app/sitemap.ts new file mode 100644 index 00000000..81a5ebf4 --- /dev/null +++ b/apps/web/src/app/sitemap.ts @@ -0,0 +1,61 @@ +import { SITE_URL } from "@/constants/site"; +import { getPosts } from "@/lib/blog-query"; +import type { MetadataRoute } from "next"; + +export default async function sitemap(): Promise<MetadataRoute.Sitemap> { + const data = await getPosts(); + + const postPages: MetadataRoute.Sitemap = + data?.posts?.map((post) => ({ + url: `${SITE_URL}/blog/${post.slug}`, + lastModified: new Date(post.publishedAt), + changeFrequency: "weekly", + priority: 0.8, + })) ?? []; + + return [ + { + url: SITE_URL, + lastModified: new Date(), + changeFrequency: "weekly", + priority: 1, + }, + { + url: `${SITE_URL}/contributors`, + lastModified: new Date(), + changeFrequency: "daily", + priority: 0.5, + }, + { + url: `${SITE_URL}/roadmap`, + lastModified: new Date(), + changeFrequency: "weekly", + priority: 1, + }, + { + url: `${SITE_URL}/privacy`, + lastModified: new Date(), + changeFrequency: "monthly", + priority: 0.5, + }, + { + url: `${SITE_URL}/terms`, + lastModified: new Date(), + changeFrequency: "monthly", + priority: 0.5, + }, + { + url: `${SITE_URL}/why-not-capcut`, + lastModified: new Date(), + changeFrequency: "yearly", + priority: 1, + }, + { + url: `${SITE_URL}/blog`, + lastModified: new Date(), + changeFrequency: "weekly", + priority: 1, + }, + ...postPages, + ]; +} diff --git a/apps/web/src/constants/site.ts b/apps/web/src/constants/site.ts new file mode 100644 index 00000000..61ec29c1 --- /dev/null +++ b/apps/web/src/constants/site.ts @@ -0,0 +1 @@ +export const SITE_URL = "https://opencut.app";
\ No newline at end of file |
