Social embed plugin

Digital Writer default Social embed plugin with support for Twitter, Facebook, Instagram, Vimeo and Soundcloud

This is handled by the writer it self, that's why the configuration for appId and disabling is placed directly in
the writer configuration.

Plugin configuration

To install the plugin, add the following configuration.

{
    "id": "io.infomaker.socialembed",
    "name": "im-socialembed",
    "url": "https://plugins.writer.infomaker.io/v1/infomaker/im-socialembed/{PLUGIN_VERSION}/index.js",
    "style": "https://plugins.writer.infomaker.io/v1/infomaker/im-socialembed/{PLUGIN_VERSION}/style.css",
    "enabled": true,
    "mandatory": false,
    "data": {
        "alternateTwitterTitle": "{author_name} wrote on twitter",
        "alternateInstagramTitle": "{author_name} posted on Instagram. {text}",
        "alternateFacebookTitle": "{author_name} posted on Facebook",
        "alternateDefaultTitle": "{author_name} posted on {provider_name}"
    }
}

Basic options

Property Type Required Description
alternateTwitterTitle String false Alternative Twitter title. {author_name} is available as a string variable that will be replaced with the actual author name.
alternateInstagramTitle String false Alternative Instagram title. {author_name} is available as a string variable that will be replaced with the actual author name.
alternateFacebookTitle String false Alternative Facebook title. {author_name} is available as a string variable that will be replaced with the actual author name.
alternateDefaultTitle String false Alternative default title. {author_name} is available as a string variable that will be replaced with the actual author name.

Disable loading of external libraries

Loading external libraries can be disabled using: disableExternalSocialEmbeds at a top level the in writer configuration file.

{
  "newsItemTemplateId": "30eae1c0-c640-4053-b114-05c64e28bbe7",
  "language": "sv_SE",
  "languageFallbacks": {
    "sv": "sv_SE",
    "en": "en_US"
  },
  "labelLanguage": "sv",
  "disableExternalSocialEmbeds": true
  ...

Add facebookAppId

facebookAppId is required at a top level the in writer configuration file.

An appId key can be retrieved by creating an app at Facebook. https://developers.facebook.com/apps/

{
  "newsItemTemplateId": "30eae1c0-c640-4053-b114-05c64e28bbe7",
  "language": "sv_SE",
  "languageFallbacks": {
    "sv": "sv_SE",
    "en": "en_US"
  },
  "labelLanguage": "sv",
  "showTextStyles": true,
  "forcePlaintextPaste": true,
  "facebookAppId": "1910680192528116",
  ...

Alternate links is created for every social embed object.

There is more information about alternate links at Writer-format at Github

Following variables could/should be defined in Writer Config.

{author_name} is available as a string variable that will be replaced with the actual author name.

Example

"data": {
  "alternateTwitterTitle": "{author_name} tweeted",
  "alternateFacebookTitle": "{author_name} posted on Facebook"
}

Output

In the article, the plugin will add the following xml block under newsItem > contentSet > inlineXML > idf > group:

<object id="socialembed-4c4cfaef42e8cf621190fc66e8089d58" type="x-im/socialembed">
    <links>
        <link rel="self" type="x-im/tweet" url="https://twitter.com/infomakernews/status/910422014271348736" uri="im://tweet/910422014271348736"/>
        <link rel="alternate" type="text/html" url="https://twitter.com/infomakernews/status/910422014271348736" title="Infomaker skrev på Twitter"/>
    </links>
</object>