<?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: Julev</title>
    <description>The latest articles on DEV Community by Julev (@rizehub-ph).</description>
    <link>https://dev.to/rizehub-ph</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%2F4217586%2Fd58805f5-3c0c-43c9-ab8f-e6aa1363ed77.png</url>
      <title>DEV Community: Julev</title>
      <link>https://dev.to/rizehub-ph</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rizehub-ph"/>
    <language>en</language>
    <item>
      <title>Back up every Webflow CMS collection to JSON with one Node script</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Wed, 25 Nov 2026 03:12:46 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/back-up-every-webflow-cms-collection-to-json-with-one-node-script-1k4g</link>
      <guid>https://dev.to/rizehub-ph/back-up-every-webflow-cms-collection-to-json-with-one-node-script-1k4g</guid>
      <description>&lt;p&gt;Before I touch a client's Webflow CMS in bulk, whether that's a CSV import, a migration, or a find-and-replace across 300 blog posts, I take a copy of every collection as JSON. It takes one script and about a minute, and it has saved me more than once when a "small" import overwrote the wrong field.&lt;/p&gt;

&lt;p&gt;Webflow does let you export a collection to CSV from the CMS. That's fine for one collection. But when a site has eight collections and you want everything in one go, with item IDs, draft and archived flags, and timestamps, the Data API is quicker.&lt;/p&gt;

&lt;p&gt;Here's the script I use.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node 18 or newer (for built-in &lt;code&gt;fetch&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;A Webflow API token with CMS read access (&lt;code&gt;cms:read&lt;/code&gt;). A site token from your site settings works.&lt;/li&gt;
&lt;li&gt;The site ID. If your token can read sites, &lt;code&gt;GET https://api.webflow.com/v2/sites&lt;/code&gt; lists them with their IDs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The script
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// backup-webflow-cms.mjs&lt;/span&gt;
&lt;span class="c1"&gt;// Node 18+. Usage: WEBFLOW_TOKEN=... WEBFLOW_SITE_ID=... node backup-webflow-cms.mjs&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;writeFile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mkdir&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:fs/promises"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;TOKEN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;WEBFLOW_TOKEN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;SITE_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;WEBFLOW_SITE_ID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;API&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://api.webflow.com/v2"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="no"&gt;TOKEN&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="no"&gt;SITE_ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Set WEBFLOW_TOKEN and WEBFLOW_SITE_ID first."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sleep&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;API&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`Bearer ${TOKEN}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;429&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;wait&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"retry-after"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Rate limited, waiting ${wait}s`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wait&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${res.status} on ${path}: ${await res.text()}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Gave up on ${path} after 5 tries`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;allItems&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;collectionId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while&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;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`/collections/${collectionId}/items?limit=100&amp;amp;offset=${offset}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pagination&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;stamp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`webflow-backup-${stamp}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;recursive&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;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`/sites/${SITE_ID}/collections`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;allItems&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;writeFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${dir}/${c.slug}.json`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;drafts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isDraft&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;archived&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isArchived&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${c.displayName}: ${items.length} items (${drafts} draft, ${archived} archived)`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Saved to ./${dir}`&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;Run it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;WEBFLOW_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;xxx &lt;span class="nv"&gt;WEBFLOW_SITE_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;yyy node backup-webflow-cms.mjs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get a dated folder with one file per collection, plus a line per collection in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Blog Posts: 214 items (6 draft, 3 archived)
Authors: 9 items (0 draft, 0 archived)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Example output, your numbers will differ.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it's built this way
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;It uses &lt;code&gt;/items&lt;/code&gt;, not &lt;code&gt;/items/live&lt;/code&gt;.&lt;/strong&gt; The live endpoint only returns published items. For a backup you want the drafts and archived items too, since those are exactly the ones nobody remembers exist until they're gone. Each item carries &lt;code&gt;isDraft&lt;/code&gt; and &lt;code&gt;isArchived&lt;/code&gt;, so you can still tell them apart.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Paging is offset based, 100 at a time.&lt;/strong&gt; That's the API's maximum &lt;code&gt;limit&lt;/code&gt;. The loop stops when a page comes back short or the offset reaches &lt;code&gt;pagination.total&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It waits on 429s instead of crashing.&lt;/strong&gt; Webflow's limit is per token: 60 requests a minute on Starter and Basic plans, 120 on CMS, eCommerce and Business. A site with a couple of thousand items can hit that. When it does, the API sends a &lt;code&gt;Retry-After&lt;/code&gt; header and the script sleeps for that long.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The whole item is saved, not just &lt;code&gt;fieldData&lt;/code&gt;.&lt;/strong&gt; IDs, &lt;code&gt;createdOn&lt;/code&gt;, &lt;code&gt;lastUpdated&lt;/code&gt; and &lt;code&gt;lastPublished&lt;/code&gt; are what you'll want when you're comparing before and after.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I actually use the files
&lt;/h2&gt;

&lt;p&gt;Most of the time it's a diff. Take a backup, do the import, take another, and compare the two folders. If an import was supposed to touch 40 posts and the diff shows 214 changed, you know before the client does.&lt;/p&gt;

&lt;p&gt;A few things to keep in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is a read-only backup, not a restore tool. Putting data back means writing it through the API again, and that's a separate script you'll want to test on a duplicate site first.&lt;/li&gt;
&lt;li&gt;Look at your own reference and multi-reference fields in the output before relying on them for anything. Check what they contain rather than assuming.&lt;/li&gt;
&lt;li&gt;Images aren't downloaded. The JSON holds whatever image data the API returns for each field, not the files.&lt;/li&gt;
&lt;li&gt;Keep the token out of the repo. An env var or a &lt;code&gt;.env&lt;/code&gt; file that's in &lt;code&gt;.gitignore&lt;/code&gt; is enough.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're setting up a CMS for a team that will be editing it every week, I wrote about the structure I use (collections, fields and the rules that stop it getting messy) here: &lt;a href="https://rizehub.ph/blog/webflow-cms-setup-for-marketing-teams" rel="noopener noreferrer"&gt;https://rizehub.ph/blog/webflow-cms-setup-for-marketing-teams&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webflow</category>
      <category>javascript</category>
      <category>node</category>
      <category>api</category>
    </item>
    <item>
      <title>Which files are blocking your first paint? A 20-line console snippet</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Mon, 23 Nov 2026 03:10:14 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/which-files-are-blocking-your-first-paint-a-20-line-console-snippet-16he</link>
      <guid>https://dev.to/rizehub-ph/which-files-are-blocking-your-first-paint-a-20-line-console-snippet-16he</guid>
      <description>&lt;p&gt;When a page shows nothing for the first second or two, the usual suspects are the stylesheets and scripts in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;. The browser won't paint until it has them. Lighthouse lists these under "render-blocking requests", but I often just want the list for one page, on a real connection, right now.&lt;/p&gt;

&lt;p&gt;Chrome tags every resource it downloads with a &lt;code&gt;renderBlockingStatus&lt;/code&gt;. So you can ask the page directly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The snippet
&lt;/h2&gt;

&lt;p&gt;Open the page, let it finish loading, open DevTools &amp;gt; Console and paste:&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="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fcp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;performance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getEntriesByName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'first-contentful-paint'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;performance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getEntriesByType&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'resource'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;renderBlockingStatus&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'blocking'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;initiatorType&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;startMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;startTime&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;doneMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;responseEnd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;kB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transferSize&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transferSize&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'n/a'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;doneMs&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;doneMs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fcp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`First contentful paint: ${Math.round(fcp.startTime)} ms`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;(&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 get a table of every render-blocking file, sorted so the one that finished last is on top. That top row is usually the one worth looking at first, since nothing paints until the slowest of them is in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading the table
&lt;/h2&gt;

&lt;p&gt;A few things that tripped me up the first time:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;kB&lt;/code&gt; says "n/a".&lt;/strong&gt; &lt;code&gt;transferSize&lt;/code&gt; is 0 when the file came from cache, and it's always 0 for files from another domain unless that server sends a &lt;code&gt;Timing-Allow-Origin&lt;/code&gt; header. Most font and tag-manager CDNs don't. For honest numbers, tick "Disable cache" in the Network tab and reload. Third-party files will still show n/a, but their &lt;code&gt;doneMs&lt;/code&gt; timing is still there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;startMs&lt;/code&gt; is big for something in the head.&lt;/strong&gt; That's often a file discovered late, like a font stylesheet pulled in by another stylesheet with &lt;code&gt;@import&lt;/code&gt;. Two round trips before paint instead of one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The table is empty.&lt;/strong&gt; Either nothing blocks (nice), or you're not in a Chromium browser. &lt;code&gt;renderBlockingStatus&lt;/code&gt; is supported in Chrome and Edge from version 107. Firefox only has it in preview builds and Safari doesn't support it, so there you'll get an empty table rather than an error.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I usually find, and the fix
&lt;/h2&gt;

&lt;p&gt;On client sites the list is rarely long. It's normally the same three kinds of thing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A script in the head without &lt;code&gt;defer&lt;/code&gt;.&lt;/strong&gt; Chat widgets, review widgets, A/B testing tools. If it doesn't need to run before the page shows, add &lt;code&gt;defer&lt;/code&gt; or move it to the end of the body. In Webflow that's the Footer code box instead of Head code. In WordPress, &lt;code&gt;wp_enqueue_script&lt;/code&gt; has accepted &lt;code&gt;'strategy' =&amp;gt; 'defer'&lt;/code&gt; since 6.3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A web font stylesheet from another domain.&lt;/strong&gt; Self-host the font files, or at least add &lt;code&gt;preconnect&lt;/code&gt; for the font host so the connection starts earlier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One big theme stylesheet.&lt;/strong&gt; That one is usually supposed to block. The question is whether it's 40 kB or 400 kB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A/B testing scripts are the exception to "just defer it". Many of them block on purpose so visitors don't see the original version flash before the variant. Check with whoever runs the tests before you touch it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before and after
&lt;/h2&gt;

&lt;p&gt;Run the snippet before a fix and note the top row and the first contentful paint line. Make one change, reload with cache disabled, run it again. If the file is gone from the table, or the top row's &lt;code&gt;doneMs&lt;/code&gt; dropped, you've moved first paint. If nothing changed, you fixed something that wasn't the bottleneck, which is also worth knowing before you touch the next thing.&lt;/p&gt;

&lt;p&gt;Do it on a throttled connection too (pick one of the throttling presets in the Network tab). On fibre everything looks fine.&lt;/p&gt;

&lt;p&gt;If you want to see which tools and scripts a site loads before you even open DevTools, we made a free checker for that: &lt;a href="https://rizehub.ph/products/tech-inspector" rel="noopener noreferrer"&gt;https://rizehub.ph/products/tech-inspector&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webperf</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>performance</category>
    </item>
    <item>
      <title>Test every 301 after a site migration with a 40-line Node script</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Fri, 20 Nov 2026 03:14:19 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/test-every-301-after-a-site-migration-with-a-40-line-node-script-4nk6</link>
      <guid>https://dev.to/rizehub-ph/test-every-301-after-a-site-migration-with-a-40-line-node-script-4nk6</guid>
      <description>&lt;p&gt;After a migration, the redirect map is the part I trust least. It's a spreadsheet of a few hundred old URLs and new URLs, put together by hand, and one typo means a page that used to rank now returns a 404.&lt;/p&gt;

&lt;p&gt;Clicking through them doesn't scale, and most online checkers want you to paste URLs in batches of ten. So I keep a tiny Node script that reads the same CSV the redirects were built from and tests every row.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it checks
&lt;/h2&gt;

&lt;p&gt;For each old URL:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It returns a &lt;strong&gt;permanent&lt;/strong&gt; redirect (301 or 308), not a 302 and not a 200.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;Location&lt;/code&gt; points at the &lt;strong&gt;exact&lt;/strong&gt; new URL in the map.&lt;/li&gt;
&lt;li&gt;The new URL itself returns a &lt;strong&gt;200&lt;/strong&gt;, not another redirect. Chains add up, and a redirect pointing at a 404 is still a 404.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The CSV
&lt;/h2&gt;

&lt;p&gt;Two columns, header row first. The same file you used to set up the redirects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;old,new
https://example.com/blog/old-post,https://example.com/articles/new-post
https://example.com/shop/blue-mug,https://example.com/products/blue-mug
https://example.com/about-us,https://example.com/about
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The script
&lt;/h2&gt;

&lt;p&gt;Needs Node 18 or newer for built-in &lt;code&gt;fetch&lt;/code&gt; (I run it on Node 22). No dependencies.&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;// check-redirects.mjs&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;readFile&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:fs/promises'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;'redirects.csv'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;readFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'utf8'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;\&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// skip the header row&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;','&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;failed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;oldUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;oldUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'manual'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'location'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// Location can be relative, so resolve it against the old URL&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;oldUrl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;href&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;301&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;308&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`status ${res.status}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`goes to ${target}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// one more hop: the new page itself should load, not redirect again&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;final&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'manual'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;final&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`target returns ${final.status}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;problem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;failed&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${problem ? 'FAIL' : 'ok  '}  ${oldUrl}  ${problem ?? ''}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`\n${rows.length - failed}/${rows.length} redirects OK`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exitCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;failed&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node check-redirects.mjs redirects.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why &lt;code&gt;redirect: 'manual'&lt;/code&gt; matters
&lt;/h2&gt;

&lt;p&gt;By default &lt;code&gt;fetch&lt;/code&gt; follows redirects and hands you the final page. That hides exactly what you're testing: you'd see a 200 and never know whether you got there through one 301, a 302, or three hops.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;redirect: 'manual'&lt;/code&gt;, Node's &lt;code&gt;fetch&lt;/code&gt; stops at the first response and gives you the real status code and the &lt;code&gt;Location&lt;/code&gt; header. (Browsers behave differently here and return an opaque response, so this is a Node-side trick, not something to run in the console.)&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;new URL(location, oldUrl)&lt;/code&gt; line is there because some servers send a relative &lt;code&gt;Location&lt;/code&gt; like &lt;code&gt;/articles/new-post&lt;/code&gt;. Resolving it against the old URL means the comparison works either way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the failures usually turn out to be
&lt;/h2&gt;

&lt;p&gt;When I run this after a migration, the failures tend to fall into a few buckets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;status 200&lt;/code&gt;&lt;/strong&gt;: the old URL still exists on the new site. Often a page that got rebuilt with the same slug, so no redirect is needed and the row can come out of the map.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;status 404&lt;/code&gt;&lt;/strong&gt;: the redirect was never added, or the old URL in the sheet has a typo or a trailing slash the server treats differently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;status 302&lt;/code&gt;&lt;/strong&gt;: someone set a temporary redirect. Fine for a sale page, wrong for a permanent move.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;goes to ...&lt;/code&gt;&lt;/strong&gt;: two rows for the same old URL, or a wildcard rule catching it before the exact one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;target returns 301&lt;/code&gt;&lt;/strong&gt;: the new URL redirects again, usually &lt;code&gt;http&lt;/code&gt; to &lt;code&gt;https&lt;/code&gt; or a trailing slash. Point the map straight at the final URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A few extras if you need them
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Big lists:&lt;/strong&gt; it runs one request at a time on purpose, which is gentle on the server. For a few thousand rows, add a short delay between requests rather than firing them all at once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI:&lt;/strong&gt; the script exits with code 1 when anything fails, so you can drop it into a deploy check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Commas in URLs:&lt;/strong&gt; the split is naive. If your URLs contain commas, use a proper CSV parser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I run this the day the new site goes live and again a week later, once the last-minute fixes have landed. It's caught more than one redirect that looked right in the spreadsheet.&lt;/p&gt;

&lt;p&gt;If you're planning a move and want the rest of the checklist (what to map, what to keep, what to watch in Search Console afterwards), I wrote it up here: &lt;a href="https://rizehub.ph/blog/wordpress-to-webflow-seo-migration" rel="noopener noreferrer"&gt;https://rizehub.ph/blog/wordpress-to-webflow-seo-migration&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>seo</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Shopify's image_tag already lazy-loads. Here's what it leaves to you.</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Wed, 18 Nov 2026 03:10:44 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/shopifys-imagetag-already-lazy-loads-heres-what-it-leaves-to-you-1k3a</link>
      <guid>https://dev.to/rizehub-ph/shopifys-imagetag-already-lazy-loads-heres-what-it-leaves-to-you-1k3a</guid>
      <description>&lt;p&gt;I used to write my own lazy-loading logic in every Shopify theme. Then I read the &lt;code&gt;image_tag&lt;/code&gt; docs properly and deleted most of it. Shopify already does more than people think, and the two things it doesn't do are the ones that actually move LCP.&lt;/p&gt;

&lt;p&gt;Here's what you get for free, what you still have to write, and a hero snippet I now paste into most theme builds.&lt;/p&gt;

&lt;h2&gt;
  
  
  What image_tag does on its own
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;featured_image&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1200&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;image_tag&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That one line gives you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; attributes&lt;/strong&gt;, taken from the image's dimensions. No layout shift as the image loads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A &lt;code&gt;srcset&lt;/code&gt;&lt;/strong&gt; with a set of widths Shopify picks, up to the width you asked for in &lt;code&gt;image_url&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;loading="lazy"&lt;/code&gt;&lt;/strong&gt; on images in sections further down the page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A modern format.&lt;/strong&gt; &lt;code&gt;image_url&lt;/code&gt; serves whatever the browser supports, WebP or AVIF included. You don't need &lt;code&gt;&amp;lt;picture&amp;gt;&lt;/code&gt; for this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice the catch in the second point. The srcset tops out at the width in &lt;code&gt;image_url&lt;/code&gt;. If you write &lt;code&gt;image_url: width: 600&lt;/code&gt; because that's how big the card looks in your design, a retina laptop never gets more than 600px and the image looks soft. Ask for the biggest size the image could ever display at, and let srcset hand out smaller ones. The cap is 5760px.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gap one: sizes
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;image_tag&lt;/code&gt; doesn't know how wide your image is in the layout. Without a &lt;code&gt;sizes&lt;/code&gt; attribute, the browser assumes the image fills the whole viewport (that's the HTML default, &lt;code&gt;100vw&lt;/code&gt;) and picks from the srcset accordingly.&lt;/p&gt;

&lt;p&gt;On a product grid that's a lot of wasted bytes. A card in a four-column grid on desktop is about a quarter of the screen, but the browser downloads a full-width file for each one.&lt;/p&gt;

&lt;p&gt;Tell it the truth:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;
  &lt;span class="n"&gt;card_product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;featured_media&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1200&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;image_tag&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;sizes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'(min-width: 990px) 25vw, (min-width: 750px) 33vw, 50vw'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;card_product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;featured_media&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;alt&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;escape&lt;/span&gt;
&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Match the breakpoints to your grid CSS. They don't have to be exact. Close is a big improvement over "assume full width".&lt;/p&gt;

&lt;h2&gt;
  
  
  Gap two: the hero
&lt;/h2&gt;

&lt;p&gt;The lazy default helps lower sections. It does nothing to make the first image load faster, and the first image is usually your LCP element. For that you want three things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;loading="eager"&lt;/code&gt; (or no lazy), so it's never deferred.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;fetchpriority="high"&lt;/code&gt;, so the browser fetches it before less important stuff.&lt;/li&gt;
&lt;li&gt;A preload hint, so the request starts before the HTML parser even reaches the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;image_tag&lt;/code&gt; has a &lt;code&gt;preload&lt;/code&gt; parameter for the third one. It sends a &lt;code&gt;Link&lt;/code&gt; preload header with the srcset and sizes included. It doesn't change the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; itself, and Shopify's docs say to use it sparingly, which makes sense: preload everything and you've prioritised nothing.&lt;/p&gt;

&lt;p&gt;For the first two, &lt;code&gt;image_tag&lt;/code&gt; passes any parameter that matches an HTML attribute straight through, so &lt;code&gt;loading&lt;/code&gt; and &lt;code&gt;fetchpriority&lt;/code&gt; just work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Knowing which section is first
&lt;/h2&gt;

&lt;p&gt;Hard-coding "this section is the hero" breaks the moment the merchant drags a different section to the top. &lt;code&gt;section.index&lt;/code&gt; solves that. It's the 1-based position of the section within its location.&lt;/p&gt;

&lt;p&gt;The location part matters: the header lives in its own section group, so the first section in the template is index 1 even though the header is above it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;liquid&lt;/span&gt;
  &lt;span class="n"&gt;assign&lt;/span&gt; &lt;span class="n"&gt;is_first&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;'template'&lt;/span&gt;
    &lt;span class="n"&gt;assign&lt;/span&gt; &lt;span class="n"&gt;is_first&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="n"&gt;endif&lt;/span&gt;

  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;is_first&lt;/span&gt;
    &lt;span class="n"&gt;assign&lt;/span&gt; &lt;span class="n"&gt;img_loading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'eager'&lt;/span&gt;
    &lt;span class="n"&gt;assign&lt;/span&gt; &lt;span class="n"&gt;img_priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'high'&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="n"&gt;assign&lt;/span&gt; &lt;span class="n"&gt;img_loading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'lazy'&lt;/span&gt;
    &lt;span class="n"&gt;assign&lt;/span&gt; &lt;span class="n"&gt;img_priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'auto'&lt;/span&gt;
  &lt;span class="n"&gt;endif&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;

&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
  &lt;span class="cp"&gt;{{&lt;/span&gt;
    &lt;span class="n"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;
    &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3200&lt;/span&gt;
    &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;image_tag&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="n"&gt;sizes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'100vw'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;img_loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;fetchpriority&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;img_priority&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;preload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;is_first&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'hero__image'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;alt&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;escape&lt;/span&gt;
  &lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;endif&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Drop it into an image banner or slideshow section (first slide only for a slideshow) and it adapts wherever the merchant puts it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two things that will confuse you
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;It looks wrong in the theme editor.&lt;/strong&gt; &lt;code&gt;section.index&lt;/code&gt; returns &lt;code&gt;nil&lt;/code&gt; in the online store editor, so &lt;code&gt;is_first&lt;/code&gt; is false there and the hero renders as lazy. That's expected. Check the real storefront, not the editor preview.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It returns nil in a few other places too.&lt;/strong&gt; Static sections (rendered with &lt;code&gt;{% section %}&lt;/code&gt; in a layout) and responses from the Section Rendering API also get &lt;code&gt;nil&lt;/code&gt;. If your hero is a static section, you'll need to set it eager by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I check it worked
&lt;/h2&gt;

&lt;p&gt;Open the storefront in Chrome, run a Lighthouse test on mobile and expand the LCP element in the report. It should be your hero image, and the "lazy load" warning for it should be gone. Then in the Network panel, filter by Img and confirm the hero request starts near the top of the waterfall, and that the grid images are small files, not full-width ones.&lt;/p&gt;

&lt;p&gt;Plenty of custom sections I open are missing one or both. The &lt;code&gt;sizes&lt;/code&gt; fix is a one-line change per snippet, so it's the first thing I'd do.&lt;/p&gt;

&lt;p&gt;If you're working through a slow store, this is part of a longer checklist I keep for Shopify speed work: &lt;a href="https://rizehub.ph/blog/shopify-speed-optimization-checklist" rel="noopener noreferrer"&gt;https://rizehub.ph/blog/shopify-speed-optimization-checklist&lt;/a&gt;&lt;/p&gt;

</description>
      <category>shopify</category>
      <category>liquid</category>
      <category>webperf</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Pull WordPress Posts Into a Webflow-Ready CSV With One Node Script</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Mon, 16 Nov 2026 03:18:19 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/pull-wordpress-posts-into-a-webflow-ready-csv-with-one-node-script-4ahn</link>
      <guid>https://dev.to/rizehub-ph/pull-wordpress-posts-into-a-webflow-ready-csv-with-one-node-script-4ahn</guid>
      <description>&lt;p&gt;Every WordPress to Webflow move I do hits the same wall at the same point. The design is built, the CMS collection is ready, and then someone exports the blog with Tools &amp;gt; Export and hands me an XML file. Webflow's CSV import doesn't take XML.&lt;/p&gt;

&lt;p&gt;Export plugins work, but I got tired of clicking through settings on every client site. So now I skip the export and pull the posts straight from the WordPress REST API with a small Node script. It writes a CSV that Webflow's importer accepts on the first try, most of the time.&lt;/p&gt;

&lt;p&gt;Here's the script and the handful of things that make it work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Webflow wants from the CSV
&lt;/h2&gt;

&lt;p&gt;Webflow's help docs are specific, and each rule shaped the script:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The file can be up to 4 MB. A blog with a few hundred long posts goes over that, so the script splits the output.&lt;/li&gt;
&lt;li&gt;The Name and Slug fields need fewer than 256 characters.&lt;/li&gt;
&lt;li&gt;Rich text accepts HTML, but Webflow strips elements, classes and attributes it doesn't support.&lt;/li&gt;
&lt;li&gt;Image fields need a direct URL that ends in an image extension. Those images don't get responsive variants, so it's worth pointing at a resized version, not the 5000px original.&lt;/li&gt;
&lt;li&gt;Reference and multi-reference fields take plain text (multi-reference separated by semicolons). Webflow turns the value into a slug and matches it. If the referenced item has a custom slug, you have to put the slug in the CSV.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last one bites people. A WordPress category called "News &amp;amp; Updates" often has the slug &lt;code&gt;news&lt;/code&gt;. Webflow would look for &lt;code&gt;news-updates&lt;/code&gt; and find nothing. So the script exports term slugs, not names, and you import your categories with those same slugs first.&lt;/p&gt;

&lt;h2&gt;
  
  
  The script
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// wp-to-webflow.mjs (Node 18+)&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;writeFileSync&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:fs'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;SITE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'https://example.com'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// the WordPress site&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;MAX_BYTES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.8&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// stay under Webflow's 4 MB&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;FIELDS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="s1"&gt;'slug'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'date_gmt'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'title'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'excerpt'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'content'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'yoast_head_json'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'_links'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'_embedded'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;','&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getAllPosts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;totalPages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`${SITE}/wp-json/wp/v2/posts?per_page=100&amp;amp;page=${page}`&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
      &lt;span class="sb"&gt;`&amp;amp;_embed=author,wp:featuredmedia,wp:term&amp;amp;_fields=${FIELDS}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`HTTP ${res.status} on page ${page}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;totalPages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'X-WP-TotalPages'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;totalPages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;decode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&amp;amp;&lt;/span&gt;#&lt;span class="p"&gt;(&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromCodePoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&amp;amp;&lt;/span&gt;#&lt;span class="nf"&gt;x&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9a&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;gi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromCodePoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&amp;amp;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;quot&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;gt&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;nbsp&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;hellip&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;amp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;quot&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'"'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nbsp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hellip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'…'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&amp;amp;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;stripTags&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;^&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&amp;gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Webflow wants a direct URL that ends in the image extension&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;importableImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;clean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'?'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;jpe&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;png&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;gif&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;webp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clean&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;clean&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;cleanContent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;html&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="p"&gt;[&lt;/span&gt;\&lt;span class="o"&gt;/?&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;z_&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;\&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;\&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;gi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;        &lt;span class="c1"&gt;// shortcodes&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="n"&gt;sstyle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"[^"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="s2"&gt;"/gi, '')              // inline styles
    .replace(/&amp;lt;p&amp;gt;(\s|&amp;amp;nbsp;|&amp;lt;br\s*\/?&amp;gt;)*&amp;lt;\/p&amp;gt;/gi, '') // empty paragraphs
    .trim();
}

function toRow(post) {
  const emb = post._embedded ?? {};
  const media = emb['wp:featuredmedia']?.[0];
  const sized = media?.media_details?.sizes?.large?.source_url;
  const terms = (emb['wp:term'] ?? []).flat();
  const slugsFor = (tax) =&amp;gt;
    terms.filter((t) =&amp;gt; t.taxonomy === tax).map((t) =&amp;gt; t.slug).join('; ');
  const yoast = post.yoast_head_json ?? {};

  return {
    Name: decode(post.title?.rendered),
    Slug: post.slug,
    'Publish Date': post.date_gmt ? `${post.date_gmt}Z` : '',
    Excerpt: stripTags(post.excerpt?.rendered).replace(/\s*\[…\]$/, ''),
    Body: cleanContent(post.content?.rendered),
    'Featured Image': importableImage(sized ?? media?.source_url),
    'Featured Image Alt': media?.alt_text ?? '',
    Author: emb.author?.[0]?.name ?? '',
    Categories: slugsFor('category'),
    Tags: slugsFor('post_tag'),
    'SEO Title': decode(yoast.title ?? ''),
    'Meta Description': decode(yoast.description ?? ''),
  };
}

const cell = (v) =&amp;gt; `"&lt;/span&gt;&lt;span class="nv"&gt;${String(v ?? '').replace(/"/g, '""')}&lt;/span&gt;&lt;span class="s2"&gt;"`;

function writeCsvFiles(rows) {
  const headers = Object.keys(rows[0]);
  const headerLine = headers.map(cell).join(',') + '\n';
  let file = 1;
  let chunk = headerLine;
  for (const row of rows) {
    const line = headers.map((h) =&amp;gt; cell(row[h])).join(',') + '\n';
    if (Buffer.byteLength(chunk + line) &amp;gt; MAX_BYTES &amp;amp;&amp;amp; chunk !== headerLine) {
      writeFileSync(`posts-${file++}.csv`, chunk);
      chunk = headerLine;
    }
    chunk += line;
  }
  writeFileSync(`posts-${file}.csv`, chunk);
  console.log(`Wrote ${rows.length} posts into ${file} file(s)`);
}

const posts = await getAllPosts();
const rows = posts.map(toRow);

for (const r of rows) {
  if (r.Name.length &amp;gt;= 256) console.warn(`Name too long: ${r.Slug}`);
  if (r.Body.includes(`${SITE}/wp-content/uploads`)) {
    console.warn(`Inline images still on WordPress: ${r.Slug}`);
  }
}

writeCsvFiles(rows);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it with &lt;code&gt;node wp-to-webflow.mjs&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The parts worth explaining
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;_fields&lt;/code&gt; plus &lt;code&gt;_embed&lt;/code&gt;.&lt;/strong&gt; Asking for only the fields you need keeps each page of 100 posts small. The catch, which is in the REST API docs but easy to miss: when you combine the two, &lt;code&gt;_links&lt;/code&gt; and &lt;code&gt;_embedded&lt;/code&gt; have to be in the &lt;code&gt;_fields&lt;/code&gt; list, or the embedded author, image and terms vanish.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SEO fields.&lt;/strong&gt; If the site runs Yoast, every post comes back with a &lt;code&gt;yoast_head_json&lt;/code&gt; object that has &lt;code&gt;title&lt;/code&gt; and &lt;code&gt;description&lt;/code&gt; in it. No database export needed. Those strings can contain HTML entities, which is why everything goes through &lt;code&gt;decode()&lt;/code&gt;. If the site uses a different SEO plugin, those two columns come out empty and you'll need that plugin's own export.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The image size.&lt;/strong&gt; &lt;code&gt;media_details.sizes.large&lt;/code&gt; is the resized copy WordPress already made. Since Webflow won't build responsive variants for CSV-imported images, starting from the large size instead of the original saves you a heavy CMS template.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The image URL.&lt;/strong&gt; I found this one by testing the script on a big public WordPress blog. Sites running Jetpack serve images through its CDN, and the REST API hands back URLs like &lt;code&gt;i0.wp.com/.../hero.png?fit=1024%2C576&amp;amp;ssl=1&lt;/code&gt;. Close to half the featured images on that blog looked like that. Webflow wants the URL to end in the file extension, so &lt;code&gt;importableImage()&lt;/code&gt; drops the query string. The downside is you get the full-size file again from the CDN, so on Jetpack sites check the sizes before import.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The warnings.&lt;/strong&gt; The inline image check is the one that matters. Images inside the post body still load from the old server after import. The day WordPress gets switched off, they break. The script tells you which posts to fix before launch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Import order in Webflow
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Import Categories and Tags first, using the WordPress slugs as the Slug column.&lt;/li&gt;
&lt;li&gt;Import Authors the same way. The script exports author names, so make sure the Author item slugs match the slugified names.&lt;/li&gt;
&lt;li&gt;Import the posts CSV. If your headers match your field names, Webflow maps them on its own.&lt;/li&gt;
&lt;li&gt;Say yes to the pre-import backup Webflow offers.&lt;/li&gt;
&lt;li&gt;Open ten posts on the live template before you trust any of it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If a required reference doesn't match, Webflow imports that row as a draft with the field blank. So "all imported" on the success screen doesn't mean everything came through.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it doesn't do
&lt;/h2&gt;

&lt;p&gt;It won't fix page-builder markup. If the old posts were built in Elementor or Divi, the content is a pile of nested divs, and a regex isn't the right tool. It also doesn't handle custom post types; change &lt;code&gt;posts&lt;/code&gt; in the URL to the type's REST base if you need those.&lt;/p&gt;

&lt;p&gt;For the field planning side (what to keep, what to drop, how to map it to a collection), I wrote up the whole process here: &lt;a href="https://rizehub.ph/blog/import-wordpress-posts-into-webflow-cms" rel="noopener noreferrer"&gt;How to import WordPress posts into the Webflow CMS&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webflow</category>
      <category>wordpress</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Stop YouTube embeds slowing your Shopify homepage: a click-to-load video section</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Fri, 13 Nov 2026 03:22:03 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/stop-youtube-embeds-slowing-your-shopify-homepage-a-click-to-load-video-section-27oj</link>
      <guid>https://dev.to/rizehub-ph/stop-youtube-embeds-slowing-your-shopify-homepage-a-click-to-load-video-section-27oj</guid>
      <description>&lt;p&gt;Paste a YouTube iframe into a Shopify section and every visitor downloads YouTube's player before they've decided to watch anything. On a homepage, that's often the heaviest thing on the page, and most people never press play.&lt;/p&gt;

&lt;p&gt;The fix is old and simple: show a cover image and a play button, and only create the iframe when someone clicks. This post is a complete section you can drop into any Online Store 2.0 theme.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, check whether you need this
&lt;/h2&gt;

&lt;p&gt;Dawn's own Video section already does this. It wraps the iframe in a &lt;code&gt;&amp;lt;template&amp;gt;&lt;/code&gt; inside a &lt;code&gt;deferred-media&lt;/code&gt; element and only loads it when the poster is clicked. So if you're on Dawn or a theme built from it and you used the built-in Video section, you're fine.&lt;/p&gt;

&lt;p&gt;Where I keep finding the problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a raw iframe pasted into a Custom Liquid section&lt;/li&gt;
&lt;li&gt;an older theme with its own video section&lt;/li&gt;
&lt;li&gt;a custom section someone built for a product story&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quick test: open DevTools, go to the Network tab, type &lt;code&gt;youtube&lt;/code&gt; in the filter and reload the page. If requests show up before you've clicked anything, keep reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  The section
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;sections/video-on-click.liquid&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;liquid&lt;/span&gt;
  &lt;span class="n"&gt;assign&lt;/span&gt; &lt;span class="n"&gt;video&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;video_url&lt;/span&gt;
  &lt;span class="n"&gt;assign&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Play video'&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;

&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;video&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;blank&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"video-on-click"&lt;/span&gt; &lt;span class="na"&gt;data-video-id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{ video.id }}"&lt;/span&gt; &lt;span class="na"&gt;data-video-type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{ video.type }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"video-on-click__poster"&lt;/span&gt; &lt;span class="na"&gt;aria-label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{ label | escape }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cover&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;blank&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
        &lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cover&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1600&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;image_tag&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'lazy'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sizes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'100vw'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;
      &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;elsif&lt;/span&gt; &lt;span class="n"&gt;video&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;'youtube'&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://i.ytimg.com/vi/{{ video.id }}/hqdefault.jpg"&lt;/span&gt; &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"480"&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"360"&lt;/span&gt; &lt;span class="na"&gt;loading&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"lazy"&lt;/span&gt; &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;endif&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"video-on-click__play"&lt;/span&gt; &lt;span class="na"&gt;aria-hidden&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;endif&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;

&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="n"&gt;stylesheet&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
  .video-on-click { position: relative; aspect-ratio: 16 / 9; background: #000; }
  .video-on-click__poster { all: unset; cursor: pointer; display: block; width: 100%; height: 100%; }
  .video-on-click__poster img,
  .video-on-click iframe { width: 100%; height: 100%; object-fit: cover; border: 0; display: block; }
  .video-on-click__play {
    position: absolute; inset: 0; margin: auto; width: 72px; height: 72px;
    border-radius: 50%; background: rgba(0, 0, 0, .65);
  }
  .video-on-click__play::after {
    content: ""; position: absolute; left: 29px; top: 22px;
    border-style: solid; border-width: 14px 0 14px 22px;
    border-color: transparent transparent transparent #fff;
  }
  .video-on-click__poster:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="n"&gt;endstylesheet&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;

&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="n"&gt;javascript&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
  document.addEventListener('click', (event) =&amp;gt; {
    const button = event.target.closest('.video-on-click__poster');
    if (!button) return;

    const box = button.parentElement;
    const id = box.dataset.videoId;
    const src = box.dataset.videoType === 'vimeo'
      ? `https://player.vimeo.com/video/${id}?autoplay=1`
      : `https://www.youtube-nocookie.com/embed/${id}?autoplay=1`;

    const iframe = document.createElement('iframe');
    iframe.src = src;
    iframe.title = button.getAttribute('aria-label');
    iframe.allow = 'autoplay; encrypted-media; picture-in-picture; fullscreen';
    iframe.allowFullscreen = true;

    box.replaceChildren(iframe);
    iframe.focus();
  });
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="n"&gt;endjavascript&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;

&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="n"&gt;schema&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
{
  "name": "Video (click to load)",
  "settings": [
    { "type": "video_url", "id": "video_url", "label": "Video URL", "accept": ["youtube", "vimeo"] },
    { "type": "image_picker", "id": "cover", "label": "Cover image" },
    { "type": "text", "id": "title", "label": "Button label (for screen readers)", "default": "Play video" }
  ],
  "presets": [{ "name": "Video (click to load)" }]
}
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="n"&gt;endschema&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why it's built this way
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;video_url&lt;/code&gt; setting does the parsing.&lt;/strong&gt; Paste a normal YouTube or Vimeo link in the theme editor and Liquid gives you &lt;code&gt;video.id&lt;/code&gt; and &lt;code&gt;video.type&lt;/code&gt;. No regex on URLs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The JavaScript lives in &lt;code&gt;{% javascript %}&lt;/code&gt;.&lt;/strong&gt; Shopify outputs that block once per section type, not once per instance. If you put a plain &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; in the section and a merchant adds the section twice, you get two click listeners, and the second one runs after the first has already swapped the button out. One delegated listener avoids all of that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A real &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;.&lt;/strong&gt; Keyboard users can tab to it and press Enter, and the label is read out. After the swap, focus moves to the iframe so they aren't dropped back at the top of the page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The cover image is the merchant's choice.&lt;/strong&gt; If they upload one, &lt;code&gt;image_tag&lt;/code&gt; gives you a srcset for free. If they don't, YouTube's &lt;code&gt;hqdefault.jpg&lt;/code&gt; thumbnail is the fallback. It exists for every video, unlike &lt;code&gt;maxresdefault.jpg&lt;/code&gt;, which is sometimes missing. Vimeo has no URL pattern for thumbnails like that, so for Vimeo videos ask for a cover image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lazy cover, unless it's the hero.&lt;/strong&gt; If this section sits at the very top of the homepage, the cover image is probably your largest paint. In that case don't lazy-load it: swap &lt;code&gt;loading: 'lazy'&lt;/code&gt; for a check on &lt;code&gt;section.index&lt;/code&gt;, the same way you would for a hero banner.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;youtube-nocookie.com.&lt;/strong&gt; YouTube's privacy-enhanced embed domain. It plays the same video. Swap it back to &lt;code&gt;www.youtube.com&lt;/code&gt; if you rely on anything that needs the standard player.&lt;/p&gt;

&lt;h2&gt;
  
  
  One trade-off
&lt;/h2&gt;

&lt;p&gt;On mobile, the click creates the iframe with &lt;code&gt;autoplay=1&lt;/code&gt;, but some browsers still want a second tap before the video plays. That's the price of not loading the player up front. I'll take one extra tap for the few people who watch over a slower homepage for everyone who doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check it worked
&lt;/h2&gt;

&lt;p&gt;Same test as before: Network tab, filter &lt;code&gt;youtube&lt;/code&gt;, reload. Nothing should load until you click the cover. Then click and the player should start.&lt;/p&gt;

&lt;p&gt;If you'd like a second pair of eyes on a slow theme, that's most of what we do: &lt;a href="https://rizehub.ph/services/shopify-theme-development" rel="noopener noreferrer"&gt;https://rizehub.ph/services/shopify-theme-development&lt;/a&gt;&lt;/p&gt;

</description>
      <category>shopify</category>
      <category>liquid</category>
      <category>webperf</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Find the Click That's Failing INP: web-vitals Attribution in 20 Lines</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Fri, 06 Nov 2026 03:13:47 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/find-the-click-thats-failing-inp-web-vitals-attribution-in-20-lines-5250</link>
      <guid>https://dev.to/rizehub-ph/find-the-click-thats-failing-inp-web-vitals-attribution-in-20-lines-5250</guid>
      <description>&lt;p&gt;Search Console says your mobile pages "need improvement" on INP. PageSpeed Insights agrees. Neither tells you which button is slow.&lt;/p&gt;

&lt;p&gt;That's the annoying part of Interaction to Next Paint. LCP points at an element. CLS points at what moved. INP gives you a number, and the interaction behind it happened on some real visitor's phone, not in your lab test.&lt;/p&gt;

&lt;p&gt;The fix is to let real visitors tell you. The &lt;code&gt;web-vitals&lt;/code&gt; library has an attribution build that reports which element was interacted with and where the time went. Here's the setup I use on client stores, mostly Shopify themes, though nothing below is Shopify-specific.&lt;/p&gt;

&lt;h2&gt;
  
  
  The snippet
&lt;/h2&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;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;onINP&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="s1"&gt;https://unpkg.com/web-vitals@5/dist/web-vitals.attribution.js?module&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;onINP&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;rating&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;attribution&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;attribution&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;script&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;longestScript&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;entry&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;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;page&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;inp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nx"&gt;rating&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                         &lt;span class="c1"&gt;// 'good' | 'needs-improvement' | 'poor'&lt;/span&gt;
      &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interactionTarget&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;    &lt;span class="c1"&gt;// CSS selector of the element&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interactionType&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;// 'pointer' or 'keyboard'&lt;/span&gt;
      &lt;span class="na"&gt;loadState&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;loadState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;inputDelay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;inputDelay&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;processing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;processingDuration&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;presentation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;presentationDelay&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;script&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sourceURL&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;invoker&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;scriptPart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;longestScript&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;subpart&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendBeacon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/your-endpoint&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Swap &lt;code&gt;/your-endpoint&lt;/code&gt; for wherever you collect data. A tiny serverless function writing to a sheet is plenty. For a first look, &lt;code&gt;console.log(payload)&lt;/code&gt; and click around on a throttled phone works too.&lt;/p&gt;

&lt;p&gt;Pin the version in production rather than pulling &lt;code&gt;@5&lt;/code&gt; from a CDN on every page view, or bundle it if you have a build step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading the three numbers
&lt;/h2&gt;

&lt;p&gt;INP is split into three parts, and each one points somewhere different.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Input delay is high.&lt;/strong&gt; The main thread was busy when the visitor tapped, so their tap waited in line. That's usually something unrelated to the button: a third-party script parsing on load, a chat widget booting, an analytics tag. Check &lt;code&gt;loadState&lt;/code&gt; here. If it says the page was still loading, the problem is what runs during load, not the click handler.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Processing is high.&lt;/strong&gt; Your own event handlers are slow. On stores, I most often see this on the variant picker and add-to-cart: one handler re-renders the price, the images, the stock message and the sticky bar, all synchronously. Split the urgent update (the button state) from the rest, and push the rest to after the next paint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Presentation delay is high.&lt;/strong&gt; The handler finished, but the browser took ages to draw the result. Big DOM changes, layout thrashing, or swapping a whole section's HTML at once. On Shopify themes, this is the section rendering pattern that replaces a large block of markup after a variant change.&lt;/p&gt;

&lt;h2&gt;
  
  
  The field that saves the most time
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;longestScript&lt;/code&gt; comes from the Long Animation Frames API and tells you which script was running longest during the slow interaction. &lt;code&gt;sourceURL&lt;/code&gt; is the file. When it's an app's script, you've just found your answer without opening a single performance trace.&lt;/p&gt;

&lt;p&gt;It won't always be filled in (browser support and cross-origin scripts limit it), so treat it as a bonus, not the only signal.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical example
&lt;/h2&gt;

&lt;p&gt;Say your data shows something like this after a day:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;target:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"button.product-form__submit"&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="err"&gt;inp:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;412&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="err"&gt;inputDelay:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;290&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="err"&gt;processing:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="err"&gt;presentation:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;52&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="err"&gt;loadState:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dom-content-loaded"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;412 ms needs improvement (good is 200 ms or less). But look where the time is: most of it is input delay, and the page hadn't finished loading. The add-to-cart handler itself is fine. What's happening is people tap "Add to cart" quickly, while something else is still booting.&lt;/p&gt;

&lt;p&gt;That changes the fix completely. Rewriting the cart code would do nothing. Delaying the review widget or the chat script until after load, or until the visitor scrolls, would.&lt;/p&gt;

&lt;h2&gt;
  
  
  Group before you fix
&lt;/h2&gt;

&lt;p&gt;Don't chase single reports. Group by &lt;code&gt;target&lt;/code&gt; and look at the 75th percentile, since that's the figure Google uses for Core Web Vitals. One element usually stands out, and it's rarely the one you'd have guessed.&lt;/p&gt;

&lt;p&gt;Once it's fixed, leave the snippet running. INP regressions tend to arrive with the next app install, not with your own code.&lt;/p&gt;

&lt;p&gt;If you're working on a Shopify theme and want help digging into this, it's part of what we do in &lt;a href="https://rizehub.ph/services/shopify-theme-development" rel="noopener noreferrer"&gt;Shopify theme development&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webperf</category>
      <category>javascript</category>
      <category>shopify</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Your Shopify Hero Image Is Probably Lazy-Loaded. Here's the Liquid Fix.</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Wed, 04 Nov 2026 03:16:20 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/your-shopify-hero-image-is-probably-lazy-loaded-heres-the-liquid-fix-3mpj</link>
      <guid>https://dev.to/rizehub-ph/your-shopify-hero-image-is-probably-lazy-loaded-heres-the-liquid-fix-3mpj</guid>
      <description>&lt;p&gt;On a lot of Shopify stores I audit, the biggest image on the homepage is also the last one the browser bothers to fetch.&lt;/p&gt;

&lt;p&gt;It's the hero banner. It's almost always the Largest Contentful Paint element on mobile. And somewhere in a custom section, someone has written &lt;code&gt;loading: 'lazy'&lt;/code&gt; on it, so the browser waits until layout is done before it even starts the download.&lt;/p&gt;

&lt;p&gt;Here's how to check for it and fix it in Liquid, without an app.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it happens
&lt;/h2&gt;

&lt;p&gt;Shopify's &lt;code&gt;image_tag&lt;/code&gt; filter already does the sensible thing. Per the docs, &lt;code&gt;loading&lt;/code&gt; is set to &lt;code&gt;lazy&lt;/code&gt; automatically for images in sections further down the page, and images near the top are left alone. If you just write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;image&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2400&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_tag&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you get a good default.&lt;/p&gt;

&lt;p&gt;The trouble starts when a theme or a freelancer "optimises" every image by hand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;image&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2400&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_tag&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;loading&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'lazy'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Passing &lt;code&gt;loading&lt;/code&gt; yourself overrides the default. Now the hero is lazy too, wherever the merchant puts that section, including first on the page. I've also seen the same thing come from old themes that used a lazy-loading JavaScript library with &lt;code&gt;data-src&lt;/code&gt; attributes, which is even worse, because the real URL isn't in the HTML at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to check in two minutes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Run the homepage through PageSpeed Insights on mobile.&lt;/li&gt;
&lt;li&gt;Open the "LCP request discovery" insight. If it says lazy load is applied to the LCP image, or that &lt;code&gt;fetchpriority=high&lt;/code&gt; should be applied, you've found it.&lt;/li&gt;
&lt;li&gt;Confirm in the HTML: view source, search for the hero's file name, and look at its &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag for &lt;code&gt;loading="lazy"&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Do the check on the live storefront, not inside the theme editor. That matters for the fix below.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: decide by section position
&lt;/h2&gt;

&lt;p&gt;Every section has &lt;code&gt;section.index&lt;/code&gt;, its 1-based position within its location (the template, or a section group like the header). That's exactly what you need: the first section on the page gets priority, everything below is lazy.&lt;/p&gt;

&lt;p&gt;Dawn does this in &lt;code&gt;sections/image-banner.liquid&lt;/code&gt;. Simplified (Dawn works out &lt;code&gt;sizes&lt;/code&gt; and &lt;code&gt;widths&lt;/code&gt; from the section settings; I've left those out):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{%-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;liquid&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nt"&gt;assign&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;fetch_priority&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'auto'&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nt"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;index&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nt"&gt;assign&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;fetch_priority&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'high'&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nt"&gt;endif&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="cp"&gt;-%}&lt;/span&gt;

&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nv"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;image&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3840&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_tag&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="na"&gt;sizes&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'100vw'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="na"&gt;fetchpriority&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;fetch_priority&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things to notice. Dawn doesn't pass &lt;code&gt;loading&lt;/code&gt; at all, it lets &lt;code&gt;image_tag&lt;/code&gt; decide. And it uses &lt;code&gt;fetchpriority&lt;/code&gt;, which isn't a named option of the filter; &lt;code&gt;image_tag&lt;/code&gt; passes through any HTML attribute you give it as a parameter, so &lt;code&gt;fetchpriority: 'high'&lt;/code&gt; ends up on the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If your section has to set &lt;code&gt;loading&lt;/code&gt; explicitly (say, a custom slideshow where only the first slide should load early), make it conditional instead of hardcoded:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{%-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;liquid&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nt"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;index&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;forloop.first&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nt"&gt;assign&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;img_loading&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'eager'&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nt"&gt;assign&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;img_priority&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'high'&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nt"&gt;else&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nt"&gt;assign&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;img_loading&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'lazy'&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nt"&gt;assign&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;img_priority&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'auto'&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nt"&gt;endif&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="cp"&gt;-%}&lt;/span&gt;

&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;image&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2400&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_tag&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;loading&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;img_loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;fetchpriority&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;img_priority&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;sizes&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'100vw'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only the first slide of the first section gets priority. Slides two and three can wait.&lt;/p&gt;

&lt;h2&gt;
  
  
  The catch: section.index is sometimes nil
&lt;/h2&gt;

&lt;p&gt;The docs list three cases where &lt;code&gt;section.index&lt;/code&gt; returns &lt;code&gt;nil&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;static sections (rendered with &lt;code&gt;{% section 'name' %}&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;while rendering in the online store editor&lt;/li&gt;
&lt;li&gt;when the section comes back through the Section Rendering API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the code above, &lt;code&gt;nil == 1&lt;/code&gt; is false, so you fall back to lazy and &lt;code&gt;auto&lt;/code&gt;. That's the safe direction, but it explains two things that confuse people. First, the editor preview will never show &lt;code&gt;fetchpriority="high"&lt;/code&gt;, so test on the live store. Second, if your hero is a static section in &lt;code&gt;theme.liquid&lt;/code&gt;, the check never passes, and you need to set it explicitly for that one section.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about preload: true?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;image_tag&lt;/code&gt; also takes &lt;code&gt;preload: true&lt;/code&gt;, which makes Shopify send a preload resource hint as a &lt;code&gt;Link&lt;/code&gt; HTTP header. It doesn't change the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag itself, and Shopify's own docs say to use it sparingly.&lt;/p&gt;

&lt;p&gt;In practice, &lt;code&gt;fetchpriority: 'high'&lt;/code&gt; on an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; that's already in the HTML is usually enough. I'd only add &lt;code&gt;preload&lt;/code&gt; when the LCP image is a CSS background or sits deep in the markup where the browser finds it late. Preloading two or three images just means they fight each other for bandwidth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't forget sizes
&lt;/h2&gt;

&lt;p&gt;One more thing I fix in the same pass. Without a &lt;code&gt;sizes&lt;/code&gt; attribute the browser assumes the image is full viewport width, which is right for a full-bleed banner but wrong for a half-width image next to text. On a phone, that can mean downloading a much bigger file than the slot needs. Set &lt;code&gt;sizes&lt;/code&gt; to match the layout, like Dawn does with &lt;code&gt;(min-width: 750px) 50vw, 100vw&lt;/code&gt; for split banners.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Search your theme for &lt;code&gt;loading: 'lazy'&lt;/code&gt; and &lt;code&gt;loading="lazy"&lt;/code&gt;. Anything in a section that can sit at the top of the page needs a condition, not a hardcoded value.&lt;/li&gt;
&lt;li&gt;Give the first image of the first section &lt;code&gt;fetchpriority: 'high'&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Leave everything else to &lt;code&gt;image_tag&lt;/code&gt;'s default.&lt;/li&gt;
&lt;li&gt;Test on the live storefront, then rerun PageSpeed Insights and check the LCP request discovery insight again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's a ten-minute change that rarely needs an app. If you'd rather someone else went through a custom theme for this kind of thing, it's part of what we do in our &lt;a href="https://rizehub.ph/services/shopify-theme-development" rel="noopener noreferrer"&gt;Shopify theme development&lt;/a&gt; work.&lt;/p&gt;

</description>
      <category>shopify</category>
      <category>liquid</category>
      <category>webperf</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Stop Double Orders: Deduplicating Shopify Webhooks in n8n</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Mon, 02 Nov 2026 03:16:29 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/stop-double-orders-deduplicating-shopify-webhooks-in-n8n-4ndp</link>
      <guid>https://dev.to/rizehub-ph/stop-double-orders-deduplicating-shopify-webhooks-in-n8n-4ndp</guid>
      <description>&lt;p&gt;Shopify's webhook docs are blunt about it: your app might receive the same webhook more than once. Most of the time the cause is on our side. Shopify allows one second to connect and five seconds for the whole request. If your workflow does its Google Sheets write, a Slack message and a CRM call before it answers, you blow past five seconds, Shopify marks the delivery as failed and sends it again. It retries up to 8 times over 4 hours. Each retry runs your whole workflow again.&lt;/p&gt;

&lt;p&gt;Here's the setup I use now on every Shopify to n8n build. Four nodes, and it takes about fifteen minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Answer Shopify straight away
&lt;/h2&gt;

&lt;p&gt;In the Webhook node, set &lt;strong&gt;Respond&lt;/strong&gt; to &lt;strong&gt;Immediately&lt;/strong&gt;. n8n returns the response code the moment the request arrives and keeps working in the background. That alone removes most duplicates, because Shopify gets its 200 well inside the timeout.&lt;/p&gt;

&lt;p&gt;The trade-off: you can't send back an error from a later node any more. That's fine here. Shopify doesn't care what you do with the order, only that you received it.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Verify the signature
&lt;/h2&gt;

&lt;p&gt;Anyone who finds your webhook URL can POST a fake order to it. Shopify signs each delivery with an &lt;code&gt;X-Shopify-Hmac-SHA256&lt;/code&gt; header: a base64 HMAC-SHA256 of the raw request body, made with your app's client secret.&lt;/p&gt;

&lt;p&gt;The catch is "raw". If you re-serialise the parsed JSON, the bytes change and the HMAC won't match. So:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the Webhook node, add the &lt;strong&gt;Raw Body&lt;/strong&gt; option. The request now comes in as binary.&lt;/li&gt;
&lt;li&gt;Add a &lt;strong&gt;Crypto&lt;/strong&gt; node, action &lt;strong&gt;Hmac&lt;/strong&gt;, type &lt;strong&gt;SHA256&lt;/strong&gt;, encoding &lt;strong&gt;BASE64&lt;/strong&gt;, and turn on &lt;strong&gt;Binary File&lt;/strong&gt; so it hashes the binary property from the webhook (check the property name in the Webhook output). The secret goes in the Crypto credential, not the node.&lt;/li&gt;
&lt;li&gt;Add an &lt;strong&gt;IF&lt;/strong&gt; node that compares the Crypto output with &lt;code&gt;{{ $('Webhook').item.json.headers['x-shopify-hmac-sha256'] }}&lt;/code&gt;. False branch goes nowhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note the lowercase header name. Headers arrive lowercased in &lt;code&gt;$json.headers&lt;/code&gt;, and &lt;code&gt;X-Shopify-Hmac-SHA256&lt;/code&gt; with capitals will quietly return nothing.&lt;/p&gt;

&lt;p&gt;After the check passes, parse the body back into JSON (an Extract From File node set to JSON, or a short Code node) so later nodes can read the order fields.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Drop deliveries you've already processed
&lt;/h2&gt;

&lt;p&gt;This is the part most tutorials skip. Shopify gives every delivery an &lt;code&gt;X-Shopify-Webhook-Id&lt;/code&gt; header, and a retry of the same delivery carries the same ID. n8n has a node built for this: &lt;strong&gt;Remove Duplicates&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Operation: &lt;strong&gt;Remove Items Processed in Previous Executions&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Keep Items Where: &lt;strong&gt;Value Is New&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Value to Dedupe On: &lt;code&gt;{{ $('Webhook').item.json.headers['x-shopify-webhook-id'] }}&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The node remembers values across executions, so the second delivery comes out with zero items and nothing downstream runs. History Size defaults to 10,000, which is plenty for a small store. Leave Scope on Node unless another node in the same workflow needs to share that history.&lt;/p&gt;

&lt;p&gt;There's a second header, &lt;code&gt;X-Shopify-Event-Id&lt;/code&gt;, and it's easy to mix the two up. The event ID is shared by every subscription that fired from the same merchant action, so if you have two subscriptions on the same topic, both deliveries carry it. Dedupe on the webhook ID if you want "process each delivery once". Use the event ID only if you deliberately want two subscriptions to collapse into one.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Make the write itself safe
&lt;/h2&gt;

&lt;p&gt;Dedupe catches retries. It won't catch everything. If you clear the node's history, rebuild the workflow, or someone replays a test, you can still get a repeat. So the last step is making the write idempotent: in Google Sheets use &lt;strong&gt;Append or Update Row&lt;/strong&gt; and match on the order ID instead of plain Append. A repeated order overwrites its own row instead of adding a new one.&lt;/p&gt;

&lt;p&gt;Same idea in a CRM: search by order ID first, then create or update.&lt;/p&gt;

&lt;h2&gt;
  
  
  The finished workflow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Webhook (Respond: Immediately, Raw Body on)
  -&amp;gt; Crypto (Hmac SHA256, base64, binary)
  -&amp;gt; IF (HMAC matches header)
  -&amp;gt; Remove Duplicates (x-shopify-webhook-id, Value Is New)
  -&amp;gt; Extract From File (JSON)
  -&amp;gt; Google Sheets (Append or Update Row, match on order id)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  One more thing worth knowing
&lt;/h2&gt;

&lt;p&gt;If your endpoint keeps failing, Shopify gives up on it. Subscriptions created through the Admin API are deleted after 8 consecutive failed deliveries. So if your n8n instance is down for a while, check the subscription still exists once it's back, or orders will stop arriving and nothing will tell you.&lt;/p&gt;

&lt;p&gt;That's the whole thing. Answer fast, check the signature, drop repeats by webhook ID, and make the final write safe to run twice.&lt;/p&gt;

&lt;p&gt;We build Shopify and n8n automations like this for small stores: &lt;a href="https://rizehub.ph/services/n8n-automation" rel="noopener noreferrer"&gt;https://rizehub.ph/services/n8n-automation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>shopify</category>
      <category>webhooks</category>
      <category>automation</category>
    </item>
    <item>
      <title>What a website tells you about itself (and two free tools that read it for you)</title>
      <dc:creator>Julev</dc:creator>
      <pubDate>Sat, 31 Oct 2026 14:55:09 +0000</pubDate>
      <link>https://dev.to/rizehub-ph/what-a-website-tells-you-about-itself-and-two-free-tools-that-read-it-for-you-4o2k</link>
      <guid>https://dev.to/rizehub-ph/what-a-website-tells-you-about-itself-and-two-free-tools-that-read-it-for-you-4o2k</guid>
      <description>&lt;p&gt;Every public website hands its visitors a surprising amount of information about how it's built. Not secrets, just the normal things a browser needs to load the page. If you know where to look, you can tell the CMS, the framework, the CDN, the analytics setup and even who handles the domain's email, without logging in to anything.&lt;/p&gt;

&lt;p&gt;Here's where that information lives. After that, two free tools we built that read it for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Response headers
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;server&lt;/code&gt;, &lt;code&gt;x-powered-by&lt;/code&gt;, &lt;code&gt;via&lt;/code&gt;, &lt;code&gt;cf-ray&lt;/code&gt; and similar headers often name the web server, the language or the CDN. A &lt;code&gt;cf-ray&lt;/code&gt; header means Cloudflare is in front. &lt;code&gt;x-powered-by: PHP/8.x&lt;/code&gt; gives away the backend. Plenty of sites strip these, which is good practice, but many don't.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The HTML and the scripts it loads
&lt;/h2&gt;

&lt;p&gt;Meta generator tags (&lt;code&gt;&amp;lt;meta name="generator" content="WordPress 6.x"&amp;gt;&lt;/code&gt;), asset paths (&lt;code&gt;/wp-content/&lt;/code&gt;, &lt;code&gt;cdn.shopify.com&lt;/code&gt;, &lt;code&gt;assets.website-files.com&lt;/code&gt;) and global variables (&lt;code&gt;window.Shopify&lt;/code&gt;, &lt;code&gt;__NEXT_DATA__&lt;/code&gt;) are strong fingerprints. Third-party script URLs give away analytics, tag managers, pixels and chat widgets.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. DNS
&lt;/h2&gt;

&lt;p&gt;MX records tell you the email provider (Google Workspace, Microsoft 365, Zoho...). TXT records hold SPF and DMARC. Those decide whether the domain's email lands in inboxes or in spam, and a surprising number of small business domains have neither.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The TLS certificate
&lt;/h2&gt;

&lt;p&gt;Who issued it and when it expires. An expired certificate is one of the most common "why is my site broken?" causes, and it's completely preventable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tool 1: Tech Inspector
&lt;/h2&gt;

&lt;p&gt;We wrapped all of this into a free checker. Paste an address and it reports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CMS and frameworks, with versions where the site shows them&lt;/li&gt;
&lt;li&gt;analytics and marketing tags&lt;/li&gt;
&lt;li&gt;hosting and CDN&lt;/li&gt;
&lt;li&gt;the email provider, plus SPF and DMARC&lt;/li&gt;
&lt;li&gt;the SSL details&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It recognizes 7,600+ technologies and gives each detection a confidence level, because fingerprints can be ambiguous. You can download the result as a PDF, which we use when scoping a rebuild or explaining to a client what their site actually runs on.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://rizehub.ph/products/tech-inspector" rel="noopener noreferrer"&gt;Tech Inspector&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tool 2: Uptime Monitor
&lt;/h2&gt;

&lt;p&gt;Knowing what a site runs on is one half. Knowing when it stops running is the other. Small business sites usually go down for boring reasons: a hosting hiccup, a plugin update, a certificate or domain that didn't renew. And the owner tends to be the last to find out, often from a customer.&lt;/p&gt;

&lt;p&gt;So we also built a free uptime monitor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It loads your page every 5 minutes.&lt;/li&gt;
&lt;li&gt;After two failed checks in a row it sends one email or SMS, then one more when the site is back. No flood of alerts.&lt;/li&gt;
&lt;li&gt;It warns you 14 days before your SSL certificate expires.&lt;/li&gt;
&lt;li&gt;An optional keyword check catches the "page loads but shows an error" case that plain ping checks miss.&lt;/li&gt;
&lt;li&gt;Response-time history and an incident log come with it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The free plan covers up to 5 sites.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://rizehub.ph/products/uptime-monitor" rel="noopener noreferrer"&gt;Uptime Monitor&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick checklist for your own site
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Does it redirect HTTP to HTTPS, and when does the certificate expire?&lt;/li&gt;
&lt;li&gt;Do you have SPF and DMARC records? (No DMARC = easier to spoof your domain.)&lt;/li&gt;
&lt;li&gt;Is the analytics tag you think is installed actually firing?&lt;/li&gt;
&lt;li&gt;Are you loading libraries you no longer use (old jQuery plugins, a second analytics tag)?&lt;/li&gt;
&lt;li&gt;Would you know within 10 minutes if the site went down at 2 AM?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If any of those made you go "hm", the two tools above will answer them in a minute.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm part of RizeHub, a small web studio in Davao City, Philippines. We build Shopify, Webflow and WordPress sites, and these tools came out of our own client work. Disclosure: both tools are ours, and both are free.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>devops</category>
      <category>tooling</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
