SEO.JSONLD (SEO v0.3.0-rc.0)

View Source

Renders JSON-LD structured data as <script type="application/ld+json"> tags.

JSON-LD (JavaScript Object Notation for Linked Data) allows you to provide structured data to search engines in a machine-readable format, enabling rich results in search listings.

You can pass any map (or list of maps) with @context and @type keys:

<SEO.JSONLD.meta
  item={%{"@context" => "https://schema.org", "@type" => "Organization", "name" => "Acme"}}
  json_library={Jason}
/>

Or use one of the helper modules for common Schema.org types:

These modules are generated at compile time by Mix.Tasks.Compile.SeoJsonld — see that module's docs for how to register the compiler and pick which Schema.org types to materialize.

"@context" is applied to the top-level node(s) at render time, so the typed builders themselves omit it — nest them freely without producing redundant contexts.

Resources

Summary

Functions

meta(assigns)

Attributes

  • item (:any)
  • json_library (:atom) (required)