惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 聂微东
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
量子位
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
B
Blog RSS Feed
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
GbyAI
GbyAI
Jina AI
Jina AI
宝玉的分享
宝玉的分享
腾讯CDC
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
D
Docker
博客园_首页
N
News and Events Feed by Topic
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Help Net Security
Help Net Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cisco Blogs
F
Fortinet All Blogs
SecWiki News
SecWiki News
AI
AI
S
Schneier on Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Last Watchdog
The Last Watchdog
Martin Fowler
Martin Fowler
A
About on SuperTechFans
T
Troy Hunt's Blog
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
Hacker News: Ask HN
Hacker News: Ask HN
F
Full Disclosure
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
InfoQ
S
Security @ Cisco Blogs
Project Zero
Project Zero
Simon Willison's Weblog
Simon Willison's Weblog
C
Cyber Attacks, Cyber Crime and Cyber Security
J
Java Code Geeks
N
News | PayPal Newsroom
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
H
Hacker News: Front Page

Next.js Blog

Next.js Security Release and Our Next Patch Release Turbopack: What's New in Next.js 16.3 Next.js 16.3: AI Improvements Next.js 16.3: Instant Navigations Next.js Across Platforms: Adapters, OpenNext, and Our Commitments Next.js 16.2: AI Improvements Next.js 16.2 Turbopack: What's New in Next.js 16.2 Building Next.js for an agentic future Inside Turbopack: Building Faster by Building Less Next.js 16.1 Next.js Security Update: December 11, 2025 Security Advisory: CVE-2025-66478 Next.js 16 Next.js 16 (beta) Next.js 15.5 Next.js 15.4 Next.js 15.3 Building APIs with Next.js Next.js 15.2 Composable Caching with Next.js Next.js 15.1 Our Journey with Caching Next.js 15 Turbopack Dev is Now Stable Next.js 15 RC 2 Next.js 15 RC Next.js 14.2 Next.js 14.1 Next.js 14 How to Think About Security in Next.js Next.js 13.5 Next.js App Router Update Next.js 13.4 Next.js 13.3 Next.js 13.2 Next.js 13.1 Next.js 13 Next.js 12.3 Next.js 12.2 Layouts RFC Next.js 12.1 Next.js 12 Next.js 11.1 Next.js 11 Next.js 10.2 Next.js 10.1 Incrementally Adopting Next.js Next.js 10 Next.js 9.5 Next.js 9.4 Next.js 9.3 Next.js 9.2 Next.js 9.1.7 Introducing Create Next App Next.js 9.1 Next.js 9.0.7 Next.js 9 Next.js 8.0.4 Styling Next.js with Styled JSX Next.js 8 Webpack Memory Improvements Next.js 8 Next.js 7 Next.js 6.1 Next.js 6 and Nextjs.org Next.js 5.1: Faster Page Resolution, Environment Config & More Next.js 5: Universal Webpack, CSS Imports, Plugins and Zones
Next.js 8.1
Connor Davis, JJ Kasper, Joe Haddad, Luis Alvarez, Tim Neutkens · 2019-04-17 · via Next.js Blog
Back to Blog

Tuesday, April 16th 2019

Posted by

Today, we're excited to announce we've extended the Next.js experience to authoring AMP pages.

  • What is AMP
  • AMP in Next.js
  • Hybrid AMP pages
  • AMP-first pages
  • AMP Validation

What is AMP?

AMP is a standard for building high-performance websites that minimizes rendering overhead and can be indexed on well known search engines with enhanced behavior. For example, AMP pages are loaded directly into Google's mobile search results and are marked by a lightning icon.

Next.js Google search result
Next.js Google search result

AMP HTML is a stricter version of HTML that imposes a few restrictions to achieve more reliable performance and better scalability. Some HTML tags are replaced with AMP-specific HTML tags to provide a better experience than its corresponding HTML tag. For example, the amp-img tag provides full srcset support even in browsers that don’t support it yet.

AMP pages are automatically discovered by search engines which support it. These search engines generally implement an AMP Cache (e.g. Google and Bing). AMP Caches help the page to render faster from their search results.

AMP in Next.js

Today, we're excited to announce we've extended the Next.js experience to authoring AMP pages. This means that you can now leverage the power of React components to create AMP pages. AMP support is defined on a per-page basis, allowing incremental adoption of AMP. There are two ways to enable AMP in Next.js: a Hybrid AMP page or an AMP-first page.

Hybrid AMP Pages

Hybrid AMP pages allow you to have an accompanying AMP version of a traditional page so search engines can show the AMP version of the page in the mobile search results while maintaining the existing version of the page. This enables the use of AMP into your application while still making use of Next.js features like client-side routing for the main user experience.

To opt-in to a hybrid AMP page use the withAmp function while providing the hybrid: true option:

One example of the hybrid AMP pattern being used in production is Reddit. Each thread is stored in Google's AMP Cache to provide a fast user experience across the mobile web while still providing the full version of Reddit for desktops and subsequent navigation.

Image of Reddit using AMP to better SEO
Image of Reddit using AMP to better SEO
Image of Reddit in AMP viewer
Image of Reddit in AMP viewer

AMP-First Pages

AMP-first pages are served to the website's primary traffic as well as search engine traffic. By using AMP-first pages, we bring the fast experience of AMP to the main website, including desktop.

To implement to AMP-first pages, you wrap pages with the withAmp function:

If you don't have a need for the Next.js runtime, using AMP-first pages could help speed up development. AMP-First requires you to only use AMP compatible components to build your pages. AMP-First pages are currently in production on nextjs.org/docs and nextjs.org/blog.

Distinguishing AMP Rendering in Components

Any React component in your project can leverage useAmp to distinguish between AMP and non-AMP rendering mode. This allows you to implement an <Image> component that shares logic between <img> and <amp-img>:

Automatic Reloading For AMP Development

In development, instead of using hot-module-replacement, we track any changes to the page you are currently on and only reload the page when it has been changed. The reason we use full reloading instead of hot-module-replacement is to make sure you are always seeing a fresh server-side render of your AMP page.

AMP Validation

To help make sure only valid AMP pages are produced, we automatically validate them with amphtml-validator during development. Errors and warnings will appear in the terminal where you started Next.js.

Pages are also validated during next export and any issues will be printed to the terminal. Any AMP errors will cause next export to fail because the export is not valid AMP.

Learn to use AMP with Next.js

In addition to learning how to use Next.js, we have added a new section to learn how to use AMP in Next.js.

Alternatively get started using the AMP example: