Microlink Recipe: JSON+LD — Microlink

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)