Skip to content

Cloudflare Pages file-count headroom (approaching the ~20k limit) #1422

Description

@bobbyonmagic

Cloudflare Pages caps a deployment at ~20,000 files. As of 2026-06-27 we deploy 18,326 files, so headroom is limited and grows with every new content item. Tracking the analysis and levers here for when we need them.

Done so far

Rough breakdown of the ~18.3k

  • ~1,670 HTML pages (one per post/tag/quiz/comparison/game/etc., trailingSlash: false)
  • ~518 .md copies (AI-readable post/advent routes)
  • ~1,231 images (1,082 png + 132 svg)
  • ~15k _next/ JS/CSS chunks — the bulk, currently unconfirmed

Confirm the _next bulk

Run on a built out/:

find out -type f | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20

Levers, ranked

  1. Threshold tag pages. 669 tags exist; 433 have only a single post. Generate only tags with ≥2 posts (~-433 pages). Filter centrally in lib/tags.ts so the [tag] generateStaticParams and the tag chips use the same filtered set (no broken links).
  2. Offload images to Cloudflare R2 (~-1,231). Biggest single win; R2 is on Cloudflare so no egress, edge-cached. Rewrite image URLs + drop public/images.
  3. Reconsider the .md copies (~-518) if the AI-readable routes aren't pulling weight.
  4. Investigate the _next/ chunk count once the diagnostic above is run (likely per-route chunks from the 45 interactive game/simulator components).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions