H5P Guides

Package Definition (h5p.json)

This page describes which properties that can be used in the h5p.json file, and which are optional.

Mandatory properties

The h5p.json file includes metadata and library dependencies for H5P content packages. 

Mandatory fields should always be included in the h5p.json file. The following fields are mandatory:

title

The title of the H5P would typically be used on pages displaying it, and in system administration lists. This can be any valid string.

  "title": "My Greeting card",

mainLibrary

The main H5P library for this content. This library will be initialized with the content data from the content folder.

  "mainLibrary": "H5P.Boardgame",

language

A standard language code. We are using the ISO-639-1 to classify all supported languages. This is a two-letter code, for example 'en' for English. A list of ISO-639-1 codes can be found at Wikipedia. Set "und" for language neutral content.

  "language": "und"

preloadedDependencies

Libraries that are used by this content type and needs to be preloaded for this content type to work. The dependencies are listed as objects with machineName, majorVersion, and minorVersion.  

This field must at least contain the main library of the package.

"preloadedDependencies": [
  {
    "machineName": "H5P.Boardgame",
    "majorVersion": 1,
    "minorVersion": 1
  }
]

embedTypes

List of possible embedding methods for the H5P. Specify one or both of "div" and "iframe".

"embedTypes": ["div"]

Optional properties

The optional fields of the h5p.json file can be included, and should be included where applicable to make the library as informative as possible. The following properties are optional for the h5p.json file:

contentType

Textual description of the type of content.

"contentType": "Media"

author

The name of the content author.

"author": "h5p"

license

A code for the content license.

The following license codes are recognized:

In addition, you can use pd for Public Domain and cr for Closed Source.

"license": "MIT"

dynamicDependencies

List of libraries that may be loaded during execution. Same format as the preloadedDependencies setting.

"dynamicDependencies": [
    {
      "machineName": "H5P.JoubelUI",
      "majorVersion": 1,
      "minorVersion": 1
    }
  ]

metaKeywords

Suggestions for keywords for this H5P application. May be used for open graph tags, etc.

"metaKeywords": "game"

metaDescription

Suggestion for application description. May be used for open graph description tags for social media.

"metaDescription": "A boardgame with multiple tasks inside"

Example

{
  "title": "Fill in the blanks",
  "mainLibrary": "H5P.Blanks",
  "contentType": "Game",
  "language": "und",
  "author": "Joubel AS",
  "license": "MIT",
  "embedTypes": ["div"],
  "preloadedDependencies": [
    {
      "machineName": "H5P.Blanks",
      "majorVersion": 1,
      "minorVersion": 0
    }
  ]
}