1. Component Guide
  2. Machine readable metadata
  3. Dataset schema with attachments
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://components.publishing.service.gov.uk/assets/govuk_publishing_components/govuk-logo-a4dbec48c2dea64aa4fa26dbec4203fd6506d714570f207ed1c4bae7359680f4.png"
    }
  },
  "image": [
    "https://components.publishing.service.gov.uk/assets/govuk_publishing_components/govuk-schema-placeholder-1x1-31bb845ef192ed4084e5f9af88bb2e790af3fc4294605212d119273d62fa4d28.png",
    "https://components.publishing.service.gov.uk/assets/govuk_publishing_components/govuk-schema-placeholder-4x3-8dde9bdabeca48eabc4eab06da67860b9a33baac84ad8943c02eedd43395f5df.png",
    "https://components.publishing.service.gov.uk/assets/govuk_publishing_components/govuk-schema-placeholder-16x9-f6d1b9e7a378ab17c6897294c9f13ef20dcff2434957f2abf894934231f4d839.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"
} %>