1. Collections Component Guide
  2. Machine readable metadata
  3. A guide
Machine readable metadata example

A guide

How it looks (preview)

<script type="application/ld+json">
  {
  "@context": "http://schema.org",
  "@type": "FAQPage",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://www.gov.uk/how-to-train-your-dragon"
  },
  "name": "How to train your dragon",
  "datePublished": null,
  "dateModified": null,
  "text": null,
  "publisher": {
    "@type": "Organization",
    "name": "GOV.UK",
    "url": "https://www.gov.uk",
    "logo": {
      "@type": "ImageObject",
      "url": "https://govuk-collections.herokuapp.com/assets/collections/govuk_publishing_components/govuk-logo-e5962881254c9adb48f94d2f627d3bb67f258a6cbccc969e80abb7bbe4622976.png"
    }
  },
  "image": [
    "https://govuk-collections.herokuapp.com/assets/collections/govuk_publishing_components/govuk-schema-placeholder-1x1-5ceffac04f7f6d4f421bd1d36dbb723ef48c15426d7f77f90be80a83af3c747e.png",
    "https://govuk-collections.herokuapp.com/assets/collections/govuk_publishing_components/govuk-schema-placeholder-4x3-fcfe16abb1a015848e50d2ea797666a9eaf5158dca38ddfb1e52dc8c0543ab74.png",
    "https://govuk-collections.herokuapp.com/assets/collections/govuk_publishing_components/govuk-schema-placeholder-16x9-fcf616879a7b37970df4d2117de962e08f7d057674ef1af6063dcdd529424eee.png"
  ],
  "mainEntity": [
    {
      "@type": "Question",
      "name": "How to train your dragon",
      "url": "https://www.gov.uk/how-to-train-your-dragon",
      "acceptedAnswer": {
        "@type": "Answer",
        "url": "https://www.gov.uk/how-to-train-your-dragon",
        "text": "\u003cp\u003eTraining scaly beasts can be tricky\u003c/p\u003e "
      }
    },
    {
      "@type": "Question",
      "name": "Preparation",
      "url": "https://www.gov.uk/how-to-train-your-dragon#preparation",
      "acceptedAnswer": {
        "@type": "Answer",
        "url": "https://www.gov.uk/how-to-train-your-dragon#preparation",
        "text": " \u003cp\u003ePrepare by meditating and writing a will\u003c/p\u003e "
      }
    },
    {
      "@type": "Question",
      "name": "Afterwards ",
      "url": "https://www.gov.uk/how-to-train-your-dragon#afterwards",
      "acceptedAnswer": {
        "@type": "Answer",
        "url": "https://www.gov.uk/how-to-train-your-dragon#afterwards",
        "text": "\u003cp\u003eYour next of kin may need a strong stomach\u003c/p\u003e\n"
      }
    }
  ]
}
</script>

<link rel="canonical" href="https://www.gov.uk/how-to-train-your-dragon" />

<meta property="og:site_name" content="GOV.UK" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://www.gov.uk/how-to-train-your-dragon" />
<meta property="og:title" content="How to train your dragon" />
<meta property="og:description" content="" />

  <meta name="twitter:card" content="summary" />

How to call this example

<%= render "govuk_publishing_components/components/machine_readable_metadata", {
  content_item: {
    title: "How to train your dragon",
    base_path: "/how-to-train-your-dragon",
    details: {
      parts: [
        {
          slug: "overview",
          body: "A thing on how to train scaly beasts",
          title: "Overview"
        },
        {
          slug: "treating-injuries",
          body: "Get to know a good blacksmith",
          title: "Treating injuries"
        }
      ]
    }
  },
  body: sanitize("<p>Training scaly beasts can be tricky</p> <h2 id='preparation'>Preparation</h2> <p>Prepare by meditating and writing a will</p> <h2 id='afterwards'>Afterwards<h2> <p>Your next of kin may need a strong stomach</p>
    "),
  schema: "faq",
  canonical_url: "https://www.gov.uk/how-to-train-your-dragon"
} %>