-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Closed
Labels
good first issueEasy to fix issues, good for newcomersEasy to fix issues, good for newcomers
Milestone
Description
Bug report
Describe the bug
Default viewport tag is being appended to and not replaced whenever you use define your own custom viewport tag.
To Reproduce
Define a simple _app.tsx that attempts to set a custom viewport meta tag.
import App from 'next/app'
import Head from 'next/head'
class MyApp extends App {
render() {
const { Component, pageProps } = this.props
return (
<>
<Head>
<title>Some Title</title>
<meta name="viewport" content="this-is-from-app.tsx" key="viewport" />
</Head>
<Component {...pageProps} />
</>
)
}
}
export default MyAppExpected behavior
I expected the default viewport tag to be deduplicated and replaced.
Screenshots
System information
- OS: macOS
- Browser (if applies): Chrome
- Version of Next.js: 9.0.7
Additional context
After doing some searching, it looks to me like the initial tag is coming from https://github.com/zeit/next.js/blob/2ba352da39ee00b6595aecdc9ffb2f103e803a85/packages/next/next-server/lib/head.tsx#L11-L23 and is not properly being deduplicated. It doesn't seem to matter if you define the same key.
jspencersharpe, hwaphon, hppRC, gurayyarar and nikola1970
Metadata
Metadata
Assignees
Labels
good first issueEasy to fix issues, good for newcomersEasy to fix issues, good for newcomers
