-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Description
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 ZEN SMP PREEMPT_DYNAMIC Sun, 04 Jun 2023 11:52:10 +0000
Binaries:
Node: 18.16.0
npm: 9.5.1
Yarn: 1.22.10
pnpm: 8.6.1
Relevant packages:
next: 13.4.5-canary.12
eslint-config-next: 13.4.5
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.3
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Metadata (metadata, generateMetadata, next/head, head.js), Static HTML Export (output: "export")
Link to the code that reproduces this issue or a replay of the bug
https://codesandbox.io/p/sandbox/reverent-feather-2sycr6
To Reproduce
- Set
output: "export"
in next.config.js - Create dynamic path (a path with param, e.g.
app/[id]/page.tsx
) which hasgenerateStaticParams
- Create
opengraph-image.tsx
for that path - Don't set
runtime
(which defaults to'auto'
/'nodejs'
) - Build Next.js (
npm run build
)
Describe the Bug
The opengraph-image
is not generated for dynamic paths when statically rendering.
In the output, it's marked as λ (Server) server-side renders at runtime
for the dynamic paths (e.g. /[id]/opengraph-image
), without listing each generated path (which /[id]
would have, e.g. /1
, /2
,).
I can confirm it generates a .html
for each path in out
, but no opengraph-image
is preset.
(It does work if it has no parameter in the path)
Expected Behavior
A opengraph-image
would be generated for each path returned by generateStaticParams
, same as the page.tsx
file would.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Statically rendered