Rendering Facebook and Tweets requires that external libraries from Twitter and Facebook is loaded in the browser.
This is handled by the writer it self, that's why the configuration for appId and disabling is placed directly in
the writer configuration.
Loading external libraries can be disabled using: disableExternalSocialEmbeds
.
"disableExternalSocialEmbeds": true
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",
...
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}"
}
}
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.
alternateTwitterTitle
alternateInstagramTitle
alternateFacebookTitle
alternateDefaultTitle
{author_name}
is available as a string variable that will be replaced with the actual author name.
Example
"alternateTwitterTitle": "{author_name} tweeted"
"alternateFacebookTitle": "{author_name} posted on Facebook"
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>