Home / Companies / Netlify / Blog / Post Details
Content Deep Dive

Rewrite HTML and transform page props in Next.js with Next.js Advanced Middleware

Blog post from Netlify

Post Details
Company
Date Published
Author
Salma Alam-Naylor
Word Count
1,726
Company Posts That Month
15
Language
English
Hacker News Points
-
Post removed?
No
Summary

Next.js Advanced Middleware allows developers to intercept and rewrite the response of a Next.js statically generated page at the edge based on geolocation data, transforming page props on the fly. With Netlify Edge Functions, this middleware can run code before an HTTP request is completed, modifying the HTTP response before it's returned. The middleware can be used to personalize pages with location-specific content, and can also update page props using `setPageProp`. The process involves creating a new Next.js project, adding a static route, and writing middleware code in TypeScript that uses Netlify Edge Functions to rewrite the HTML response. The demo site is deployed to Netlify, where the changes can be seen in real-time on a live URL.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Developer Experience 1 141 96 60 -25%
Real-time 1 1,407 370 141 +5%
Serverless 1 818 121 66 +16%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.