I know that you
that is in the title of the post.
But using $type (please click on the link and look at the examples) is a server thing. It has nothing to do with nextjs or what ever client you are using.
I just found out the following which might be a better solution