diff --git a/app/(marketing)/[slug]/page.tsx b/app/(marketing)/[slug]/page.tsx index 4f6bab7..8dbb352 100644 --- a/app/(marketing)/[slug]/page.tsx +++ b/app/(marketing)/[slug]/page.tsx @@ -80,7 +80,13 @@ export default async function MarketingPage({ aria-label="Published date" className="text-gray-800 dark:text-gray-300" > - Last Updated: {data.lastUpdated} + Last Updated:{" "} + {data.lastUpdated.toLocaleDateString(undefined, { + weekday: "long", + year: "numeric", + month: "long", + day: "numeric", + })} {" "} diff --git a/app/robots.txt b/app/robots.txt new file mode 100644 index 0000000..d3bba61 --- /dev/null +++ b/app/robots.txt @@ -0,0 +1,8 @@ +User-Agent: * +Allow: / +Disallow: /chat/ +Disallow: /writer/ +Disallow: /auth/ +Disallow: /api/ + +Sitemap: https://pegna.ai/sitemap.xml diff --git a/app/sitemap.ts b/app/sitemap.ts new file mode 100644 index 0000000..75d75a3 --- /dev/null +++ b/app/sitemap.ts @@ -0,0 +1,45 @@ +import fs from "fs"; +import path from "path"; +import type { MetadataRoute } from "next"; +import matter from "gray-matter"; + +function getMarketingPages(): MetadataRoute.Sitemap { + // Get all marketing pages + const contentDir = path.join(process.cwd(), "content/marketing"); + + try { + const files = fs.readdirSync(contentDir); + return files + .filter((file) => file.endsWith(".mdx")) + .map((file) => { + const filePath = path.join( + process.cwd(), + "content/marketing/", + `${file}`, + ); + const fileContent = fs.readFileSync(filePath, "utf8"); + const { data } = matter(fileContent); + return { + url: `${process.env.APP_BASE_URL}/${file.replace(/\.mdx$/, "")}`, + lastModified: data.lastUpdated || new Date(), + changeFrequency: "yearly", + priority: 1, + }; + }); + } catch (error) { + console.error("Error reading content directory:", error); + return []; + } +} + +export default function sitemap(): MetadataRoute.Sitemap { + return [ + { + url: `${process.env.APP_BASE_URL}/`, + lastModified: new Date(), + changeFrequency: "yearly", + priority: 1, + }, + ...getMarketingPages(), + ]; +} diff --git a/content/marketing/privacy.mdx b/content/marketing/privacy.mdx index f1fc015..c66e589 100644 --- a/content/marketing/privacy.mdx +++ b/content/marketing/privacy.mdx @@ -1,7 +1,7 @@ --- title: Privacy Policy description: How we collect, use, and protect your personal information -lastUpdated: April 5, 2025 +lastUpdated: 2025-04-05 --- ## 1. Introduction diff --git a/content/marketing/terms.mdx b/content/marketing/terms.mdx index 6cab09d..c107290 100644 --- a/content/marketing/terms.mdx +++ b/content/marketing/terms.mdx @@ -1,7 +1,7 @@ --- title: Terms and Conditions description: Legal terms and conditions for using our service -lastUpdated: April 5, 2025 +lastUpdated: 2025-04-05 --- ## 1. Introduction