带有React的Google AMP [英] Google AMP with React
问题描述
我们有一个同构的带有节点的react App.我想将某些页面转换为AMP页面.我很迷惑!我们应该单独购买该应用程序的AMP版本,还是应该根据Google的AMP页面指南修改当前的应用程序?我可以看到我们必须在当前应用程序中进行很多更改才能制作兼容放大器的版本.我应该如何进行?
We have an isomorphic react App with node. I want to convert some pages to AMP pages. I am confused! Shall we go for a separate AMP version of the app or shall we modify the current app according to Google guidelines for AMP Pages? I can see we have to make a lot of changes in the current app to make an amp compatible version. How should I proceed?
推荐答案
Next.js现在支持AMP.他们提供了多种解决方案(仅适用于AMP和适用于AMP的解决方案).由于您可以在页面级别启用AMP,因此可以缓慢迁移到完整的AMP网站.
Next.js now supports AMP. They provide multiple approaches (AMP-only & AMP-hybrid) to solve this problem. Since you can enable AMP on page level you can slowly migrate to a full AMP website.
示例
// pages/about.js
export const config = { amp: true }
export default function AboutPage(props) {
return <h3>My AMP About Page!</h3>
}
})
这样,您就可以同时支持两者.反应客户端渲染和纯AMP.
This way you can support both. React client rendering and pure AMP.
这篇关于带有React的Google AMP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!