Skip to content

Commit

Permalink
feat: Update dynamic rendering to 'force-static' and enhance static p…
Browse files Browse the repository at this point in the history
…arameter generation
  • Loading branch information
SivaramPg committed Dec 16, 2024
1 parent 2d46211 commit 821883b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/[category]/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import Breadcrumbs from "@/components/Breadcrumbs"
import RequestDisplayElement from "@/components/RequestDisplayElement"
import ResponseDisplayElement from "@/components/ResponseDisplayElement"

export const dynamic = "force-static"

export async function generateStaticParams() {
const slugs: { category: string; slug: string }[] = []

Expand All @@ -19,7 +21,9 @@ export async function generateStaticParams() {
for (const category of rawCategories) {
if (
category.isFile() &&
!["all.json", ".DS_Store", "root.json"].includes(category.name)
!["all.json", ".DS_Store", "root.json", "schema.json"].includes(
category.name,
)
) {
const categoryName = category.path.split("/").at(-1)

Expand Down
2 changes: 2 additions & 0 deletions src/app/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import RequestDisplayElement from "@/components/RequestDisplayElement"
import { LinkPill } from "@/components/link-pill"
import { capitalize } from "@/utils/capitalize"

export const dynamic = "force-static"

export async function generateStaticParams() {
const categories: { category: string }[] = []

Expand Down
2 changes: 2 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Link from "next/link"
import { AboutTheProject } from "./_components/AboutTheProject"
import HeroSection from "./_components/HeroSection"

export const dynamic = "force-static"

async function getRootJson() {
const jsonFile = await fsPromises.readFile(
path.resolve(__dirname, "../../../public/api/root.json"),
Expand Down

0 comments on commit 821883b

Please sign in to comment.