iamcal / oembed

The oEmbed Spec
http://oembed.com
MIT License
1.32k stars 647 forks source link

Allow for static sites to be discoverable without a true endpoint #144

Open goodevilgenius opened 8 years ago

goodevilgenius commented 8 years ago

I was thinking about how a static site might support oEmbed, and, it seems impossible currently if complying to the full spec.

I was thinking the spec could be changed so that it might be possible for such sites to be discoverable, with static json and xml files, without a true endpoint.

E.g., imagine a blog hosted at http://example.com/ that is built with Jekyl. A single blog post might be at http://example.com/2015/10/my-post.html. Within the <head> for that page, would be <link> tags for oEmbed discovery, which might say:

<link rel="alternate" type="application/json+oembed"
  href="http://example.com/oembed/2015/10/my-post.json" title="My Post oEmbed Profile" />
<link rel="alternate" type="text/xml+oembed"
  href="http://example.com/oembed/2015/10/my-post.xml" title="My Post oEmbed Profile" />

However, there would be no true endpoint. You couldn't, e.g., GET http://example.com/oembed?url=http%3A%2F%2Fexample.com%2F2015%2F10%2Fmy-post.html&format=json.

This would provide a lower barrier for small sites to support their own oEmbed.

twalling commented 8 years ago

To take this idea a step further I think it would be nice for static sites to provide the entire json response inline in the page. Similar to how CSS can be included via a link tag or inlined.