Embed Fieldtype

Fieldtype for embedding and previewing external content

Embed Fieldtype Main Screenshot

Fieldtype for embedding and previewing external content.

Example embed field

Features

  • Augment URLs with embed data: iframe, thumbnail, title, description
  • Live preview of embedded content in the control panel
  • Powered by the Embed library and extensible with custom adapters
  • Supports any provider with oEmbed endpoint or Open Graph meta tags
  • Site-wide list of embed providers for cookie banners and consent gates

Vs. the Built-In Video Fieldtype

If you need to embed videos from YouTube and Vimeo, you should probably stick with Statamic's built-in video fieldtype. It comes with less complexity as it doesn't need to fetch the metadata or embed codes.

The fieldtype of this addon becomes useful if you need:

  • Other providers and content types like audio players, social media posts, etc
  • Ready-to-render html for embedding the content in an iframe
  • Additional metadata like title, description, thumbnail, etc
  • A list of all used providers for global consent gates

Quick Start

  1. Install using composer require daun/statamic-embed-fieldtype
  2. Add an embed field to your blueprint
  3. Render the embed using the field name in your views
<article>
{{ if embed:code }}
{{ embed:code:html }}
{{ elseif embed:image }}
<img src="{{ embed:image:url }}">
{{ /if }}
<a href="{{ embed:url }}">{{ embed:title }}</a>
<p>{{ embed:author:name }} · {{ embed:provider:name }}</p>
</article>

Documentation

Read the documentation for a detailed guide.

License

MIT