<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Enes Demirci</title>
    <description>The latest articles on DEV Community by Enes Demirci (@enesdmc0).</description>
    <link>https://dev.to/enesdmc0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1375740%2F05b2c5fb-2b40-41d6-804d-8b0769565e2e.webp</url>
      <title>DEV Community: Enes Demirci</title>
      <link>https://dev.to/enesdmc0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/enesdmc0"/>
    <language>en</language>
    <item>
      <title>Why Your Next.js Site on Cloudflare Pages Isn't Scoring 100 on PageSpeed</title>
      <dc:creator>Enes Demirci</dc:creator>
      <pubDate>Sun, 19 Jul 2026 09:54:44 +0000</pubDate>
      <link>https://dev.to/enesdmc0/why-your-nextjs-site-on-cloudflare-pages-isnt-scoring-100-on-pagespeed-4nk5</link>
      <guid>https://dev.to/enesdmc0/why-your-nextjs-site-on-cloudflare-pages-isnt-scoring-100-on-pagespeed-4nk5</guid>
      <description>&lt;p&gt;I kept hitting the same three problems deploying Next.js App Router&lt;br&gt;
sites as a static export on Cloudflare Pages across multiple client&lt;br&gt;
projects. None of them throw a loud error — they just quietly cost&lt;br&gt;
PageSpeed points until you know to look for them.&lt;/p&gt;

&lt;p&gt;Here's the site scoring 100/100 across the board, verified today:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuca0bn5pcwd7z4b55ijt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuca0bn5pcwd7z4b55ijt.png" alt="Image" width="799" height="388"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1. next/image breaks silently in static export
&lt;/h2&gt;

&lt;p&gt;The default Image Optimization API calls a live server endpoint to&lt;br&gt;
resize and re-encode images on demand. &lt;code&gt;output: 'export'&lt;/code&gt; produces no&lt;br&gt;
server — Cloudflare Pages serves static files only. The component&lt;br&gt;
doesn't always throw; it can silently serve unoptimized full-size&lt;br&gt;
originals instead.&lt;/p&gt;

&lt;p&gt;Fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// next.config.js&lt;/span&gt;
&lt;span class="nx"&gt;images&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;unoptimized&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You lose automatic resizing, so pre-export images as WebP/AVIF before&lt;br&gt;
they enter the project rather than shipping camera-resolution files.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. A manual Google Fonts link tag blocks first paint
&lt;/h2&gt;

&lt;p&gt;This pattern is everywhere:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.googleapis.com/css2?family=Inter"&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It forces a round trip to a third-party domain before any text can&lt;br&gt;
render. On the mobile connections PageSpeed simulates, that's a direct&lt;br&gt;
hit to Largest Contentful Paint.&lt;/p&gt;

&lt;p&gt;Fix — use &lt;code&gt;next/font&lt;/code&gt;, which downloads the font at build time and&lt;br&gt;
self-hosts it from your own domain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Inter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/font/google&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;inter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Inter&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;subsets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;latin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="na"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;swap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Zero runtime request to Google's servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Cloudflare Pages doesn't cache aggressively by default
&lt;/h2&gt;

&lt;p&gt;You have to declare it yourself in a &lt;code&gt;public/_headers&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;/&lt;span class="err"&gt;_&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt;/&lt;span class="n"&gt;static&lt;/span&gt;/*
  &lt;span class="n"&gt;Cache&lt;/span&gt;-&lt;span class="n"&gt;Control&lt;/span&gt;: &lt;span class="n"&gt;public&lt;/span&gt;, &lt;span class="n"&gt;max&lt;/span&gt;-&lt;span class="n"&gt;age&lt;/span&gt;=&lt;span class="m"&gt;31536000&lt;/span&gt;, &lt;span class="n"&gt;immutable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The result
&lt;/h2&gt;

&lt;p&gt;Same site, same content, three small changes — Performance,&lt;br&gt;
Accessibility, Best Practices, and SEO all at 100, desktop and mobile.&lt;/p&gt;

&lt;p&gt;I packaged this as a Claude Code/Cursor skill so I don't have to&lt;br&gt;
re-solve it by hand on every new client project — free diagnostic&lt;br&gt;
version is &lt;a href="https://github.com/enesdmc0/nextjs-cloudflare-static-seo-lite" rel="noopener noreferrer"&gt;on GitHub&lt;/a&gt;, full pack with ready-made&lt;br&gt;
config templates is &lt;a href="https://enesdmc.lemonsqueezy.com/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Happy to answer questions about static export edge cases in the&lt;br&gt;
comments.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>cloudflarechallenge</category>
      <category>webdev</category>
      <category>webperf</category>
    </item>
  </channel>
</rss>
