diff --git a/apps/www/app/blog/[slug]/page.tsx b/apps/www/app/blog/[slug]/page.tsx index 2cf612dba04..06ab202bd91 100644 --- a/apps/www/app/blog/[slug]/page.tsx +++ b/apps/www/app/blog/[slug]/page.tsx @@ -1,11 +1,10 @@ -import { draftMode } from 'next/headers' +import BlogPostClient from './BlogPostClient' import { getAllPostSlugs, getPostdata, getSortedPosts } from 'lib/posts' import { getAllCMSPostSlugs, getCMSPostBySlug } from 'lib/get-cms-posts' +import { draftMode } from 'next/headers' import type { Blog, BlogData, PostReturnType } from 'types/post' -import BlogPostClient from './BlogPostClient' - type MatterReturn = { data: BlogData content: string diff --git a/apps/www/app/blog/categories/[category]/page.tsx b/apps/www/app/blog/categories/[category]/page.tsx index 85ef11c5aa1..00fe2ba1605 100644 --- a/apps/www/app/blog/categories/[category]/page.tsx +++ b/apps/www/app/blog/categories/[category]/page.tsx @@ -14,7 +14,7 @@ export async function generateStaticParams() { return categories.map((category: string) => ({ category })) } -export const revalidate = 600 +export const dynamic = 'force-static' export async function generateMetadata({ params }: { params: Params }): Promise { const capitalizedCategory = startCase(params.category.replaceAll('-', ' ')) diff --git a/apps/www/app/blog/page.tsx b/apps/www/app/blog/page.tsx index ab9385dbaac..03718f15ef7 100644 --- a/apps/www/app/blog/page.tsx +++ b/apps/www/app/blog/page.tsx @@ -1,9 +1,7 @@ -import fs from 'fs' -import type { Metadata } from 'next' -import { generateRss } from 'lib/rss' +import BlogClient from './BlogClient' import { getSortedPosts } from 'lib/posts' import { getAllCMSPosts } from 'lib/get-cms-posts' -import BlogClient from './BlogClient' +import type { Metadata } from 'next' export const dynamic = 'force-static' @@ -33,25 +31,7 @@ export default async function BlogPage() { return dateB - dateA }) - // Generate RSS feed from static posts - const rss = generateRss(allPostsData) - try { - fs.writeFileSync('./public/rss.xml', rss) - } catch {} - - // Generate PlanetPG author feeds - try { - const planetPgPosts = allPostsData.filter((post: any) => post.tags?.includes('planetpg')) - const planetPgAuthors = planetPgPosts.map((post: any) => post.author.split(',')) - const uniquePlanetPgAuthors = new Set(([] as string[]).concat(...(planetPgAuthors as any))) - uniquePlanetPgAuthors.forEach((author) => { - const authorPosts = planetPgPosts.filter((post: any) => post.author.includes(author)) - if (authorPosts.length > 0) { - const authorRss = generateRss(authorPosts, author as string) - fs.writeFileSync(`./public/planetpg-${author}-rss.xml`, authorRss) - } - }) - } catch {} + // RSS writing moved out of runtime to avoid tracing the entire public directory into serverless bundles return } diff --git a/apps/www/app/blog/tags/[tag]/page.tsx b/apps/www/app/blog/tags/[tag]/page.tsx index 5a02d17f6cb..f51f37afa44 100644 --- a/apps/www/app/blog/tags/[tag]/page.tsx +++ b/apps/www/app/blog/tags/[tag]/page.tsx @@ -14,7 +14,7 @@ export async function generateStaticParams() { return tags.map((tag: string) => ({ tag })) } -export const revalidate = 600 +export const dynamic = 'force-static' export async function generateMetadata({ params }: { params: Params }): Promise { const capitalizedTag = startCase(params.tag.replaceAll('-', ' '))