Looking for a util that transforms html <meta> tags into NextJS's Metadata type
Unanswered
Munchkin posted this in #help-forum
MunchkinOP
Does such a thing exist?
I'm working with a service that returns metadata in "raw" form, e.g.
This is, of course, quite error prone. I've looked around to see if there is already a parser out there, but so far no luck. There are many general-purpose XML parsers on NPM, but if I go that route I'd still have to do a fair bit of transformation to conform to the Metadata format.
Many thanks for any leads!
I'm working with a service that returns metadata in "raw" form, e.g.
<meta property="og:title" content="OG page title">. I've written a parser that turn that string into Next's Metadata type: https://github.com/vercel/next.js/blob/ce4aa787e8fade5f8214817f8ad9db02ca807a95/packages/next/src/lib/metadata/types/metadata-interface.ts#L39This is, of course, quite error prone. I've looked around to see if there is already a parser out there, but so far no luck. There are many general-purpose XML parsers on NPM, but if I go that route I'd still have to do a fair bit of transformation to conform to the Metadata format.
Many thanks for any leads!