Skip to content
Discussion options

You must be logged in to vote

Try setting shallow: false, as generateMetadata is a server-side called function, so you need to do a round-trip to the server. Note that this is kind of dumb (but I don't make the Next.js rules), unless you actually need those search params on the server for SSR.

If you want to update it client-side (so that it shows nicely in the browser), you could do it this way:

// Assuming for the example that we want `?title=foo` to show a title of "foo"
const [title] = useQueryState('title')

useEffect(() => {
  document.title = title
}, [title])

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Sparticuz
Comment options

Answer selected by Sparticuz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants