Link previews for Editor.js

The official @editorjs/link plugin needs a backend that fetches the page and returns {"success":1,"meta":{"title","description","image":{"url"}}}. Browsers can't fetch other sites directly because of CORS, so you'd normally write that server yourself. /v1/linktool is that backend.

Setup

import LinkTool from "@editorjs/link";
new EditorJS({
  tools: {
    linkTool: {
      class: LinkTool,
      config: { endpoint: "https://YOUR-UNFURLR-HOST/v1/linktool?key=pk_YOUR_PUBLISHABLE_KEY" }
    }
  }
});

The plugin sends GET endpoint?url=…; we always answer HTTP 200 with success: 1 or success: 0 plus an error, so the plugin never crashes.

Limits, honestly

Get a free key LinkTool docs