Class: SchemaOrgView

SchemaOrgView()

Inserts and updates the Schema.org JSON-LD script tag in the head of the document. This view will only work if the JSON-LD feature is enabled in the MetacatUI configuration. Otherwise, no JSON-LD script tag will be inserted into the head of the document.

Constructor

new SchemaOrgView()

Since:
  • 2.32.0
Source:

Extends

  • Backbone.View

Members

template :string

Default JSON LD to use for pages that don't have a specific schema.
Type:
  • string
Source:

Methods

addJsonldEl() → {HTMLScriptElement}

Inserts the JSON-LD script tag into the head of the document.
Source:
Returns:
The JSON-LD element.
Type
HTMLScriptElement

createJsonldEl() → {HTMLScriptElement}

Create the JSON LD element to insert into the head of the document.
Source:
Returns:
The JSON LD element.
Type
HTMLScriptElement

getExistingJsonldEls() → {NodeListOf.<HTMLScriptElement>}

Get all the existing JSON-LD elements in the head of the document.
Source:
Returns:
The existing JSON-LD elements.
Type
NodeListOf.<HTMLScriptElement>

initialize()

Source:

isEnabled() → {boolean}

Checks if the JSON-LD feature is enabled in the MetacatUI configuration.
Source:
Returns:
True if the JSON-LD feature is enabled, false otherwise.
Type
boolean

onClose()

What to do when the view is closed.
Source:

removeExistingJsonldEls()

Removes any existing JSON-LD elements from the head of the document.
Source:

render()

Source:

setSchema(type, model)

Updates the JSON-LD script tag in the head of the document based on the type of page being viewed.
Parameters:
Name Type Description
type "Dataset" | "DataCatalog" The type of page being viewed. If neither "Dataset" nor "DataCatalog" is provided, the schema will be set to the default schema.
model object The model to use for the schema.
Since:
  • 2.32.0
Source:

setSchemaFromTemplate()

Sets the schema based on a template.
Source:

updateJsonldEl()

Updates the JSON-LD script tag in the head of the document based on the model values.
Source: