mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
4238878c17
Co-authored-by: Tim Neutkens <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
30 lines
559 B
JavaScript
30 lines
559 B
JavaScript
import { useAmp } from 'next/amp'
|
|
|
|
export const config = {
|
|
amp: 'hybrid',
|
|
}
|
|
|
|
export const getStaticProps = (ctx) => {
|
|
return {
|
|
props: {
|
|
slug: ctx.params?.slug || null,
|
|
hello: 'hello',
|
|
random: Math.random(),
|
|
},
|
|
}
|
|
}
|
|
|
|
export const getStaticPaths = () => ({
|
|
paths: ['/blog/post-1', '/blog/post-2'],
|
|
fallback: false,
|
|
})
|
|
|
|
export default ({ hello, random, slug }) => (
|
|
<>
|
|
<p id="use-amp">useAmp: {useAmp() ? 'yes' : 'no'}</p>
|
|
<p id="hello">{hello}</p>
|
|
<p id="random">{random}</p>
|
|
<p id="slug">{slug}</p>
|
|
</>
|
|
)
|