Machine readable metadata example

Dataset schema with attachments

How it looks (preview)

<script type="application/ld+json">
  {
  "@context": "http://schema.org",
  "@type": "Dataset",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://www.gov.ukgovernment/statistical-data-sets/hogwarts-data"
  },
  "name": "All the data about Hogwarts",
  "datePublished": null,
  "dateModified": null,
  "text": null,
  "publisher": {
    "@type": "Organization",
    "name": "GOV.UK",
    "url": "https://www.gov.uk",
    "logo": {
      "@type": "ImageObject",
      "url": "https://content-publisher.publishing.service.gov.uk/assets/content-publisher/govuk_publishing_components/govuk-logo-b15a4d254746d1642b8187217576d1e8fe50b51352d352fda13eee55d3c1c80a.png"
    }
  },
  "image": [
    "https://content-publisher.publishing.service.gov.uk/assets/content-publisher/govuk_publishing_components/govuk-schema-placeholder-1x1-c3d38c0d4fc00005df38a71e1db7097276681d6917bca58f0dc8336a252e1bb3.png",
    "https://content-publisher.publishing.service.gov.uk/assets/content-publisher/govuk_publishing_components/govuk-schema-placeholder-4x3-edc38c137a14ecfc3fc83f404090e20dab806dad345c96a1df6a163ee2d1e3aa.png",
    "https://content-publisher.publishing.service.gov.uk/assets/content-publisher/govuk_publishing_components/govuk-schema-placeholder-16x9-5dc2d0ea1eb72cd94e66db210ef41b22ce364e7ed09d63a3acc28fda09e27864.png"
  ],
  "distribution": [
    {
      "name": "List of headmasters",
      "contentUrl": "https://assets.publishing.service.gov.uk/hogwarts-data/headmasters.csv",
      "encodingFormat": "text/csv"
    },
    {
      "name": "Houses of Hogwarts",
      "url": "https://www.gov.uk/government/statistical-data-sets/hogwarts-data/houses"
    },
    {
      "name": "Dungeon cleaning shedule",
      "url": "https://hogwarts.gov.uk/datasets/dungeon-cleaning-schedule"
    }
  ]
}
</script>

<link rel="canonical" href="https://www.gov.ukgovernment/statistical-data-sets/hogwarts-data" />

<meta property="og:site_name" content="GOV.UK" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://www.gov.ukgovernment/statistical-data-sets/hogwarts-data" />
<meta property="og:title" content="All the data about Hogwarts" />
<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: "All the data about Hogwarts",
    base_path: "government/statistical-data-sets/hogwarts-data",
    details: {
      attachments: [
        {
          attachment_type: "file",
          url: "https://assets.publishing.service.gov.uk/hogwarts-data/headmasters.csv",
          title: "List of headmasters",
          content_type: "text/csv",
          id: "headmasters.csv"
        },
        {
          attachment_type: "html",
          url: "https://www.gov.uk/government/statistical-data-sets/hogwarts-data/houses",
          title: "Houses of Hogwarts",
          id: "houses"
        },
        {
          attachment_type: "external",
          url: "https://hogwarts.gov.uk/datasets/dungeon-cleaning-schedule",
          title: "Dungeon cleaning shedule",
          id: "dungeon-cleaning-schedule"
        }
      ]
    }
  },
  schema: "dataset"
} %>