Skip to content

JSON+LD

Retrieve all JSON+LD elements present on the website

jsonLd.js
const mql = require('@microlink/mql')

const jsonLd = async (url, opts) => {
  const { data } = await mql(url, {
    meta: false,
    data: {
      jsonLd: {
        selectorAll: 'script[type="application/ld+json"]'
      }
    },
    ...opts
  })

  return data.jsonLd
}

const result = await jsonLd('https://microlink.io')

mql.render(result)