Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
104 lines (92 sloc) 5.65 KB

Share block

The share block provides the ability to share a link to social media pages so people can easily post a link to your website or product.

All available properties of this block type are mentioned in the table below.

Share block properties

Property Value Description
type "share" Property to identify the block as a share block.
label string The label to show above all the social buttons.
platforms array A list of the platforms which we should be displaying in this share block.
icon object The type and size of each social icon.
link object Contains the required link url and the optional link title to share on the timeline/wall of the user on the external social platform.
description string Contains the optional link description to share on the timeline/wall of the user on the external social platform.
facebook object Optional and used only if facebook is added as property in platforms. Contains the facebook properties appid and redirect_uri.
twitter object Optional and used only if twitter is added as property in platforms. Contains the twitter properties hashtags and via.
font object Override the template wide default font properties to style the label property.
background object The background settings for the share block.
margin mixed Margins around the share block.
padding mixed Whitespace around the block, this whitespace will have a background.
visibility object Visibility based on device, client and/or receiver.
container object Access to the surrounding container.
align string The alignment of the social media icons of this block and their label text.

Attributes

Just like some other blocks we support to apply custom attributes on the links. But as a share block is essentially a collection we support custom attributes for each element. We support attributes in the same way that we support the custom platform settings. Meaning you can simply add the attributes object to the platform object.

Example usage

The following input JSON shows how to show a share block in a document. This is the basic usage, showing a set of share buttons.

{
    "from" : "info@example.com",
    "subject" : "Email with a share block",
    "content" : {
        "blocks" : [ {
            "type"      : "share",
            "label"     : "Tell your friends about us!",
            "align"     : "left",
            "icon"      : {
                "type"      : "rounded",
                "size"      : 32
            },
            "link"      : {
                "url"       : "https://responsiveemail.com/",
                "title"     : "Post title"
            },
            "description"   : "Optional prefilled text to share",
            "platforms" : [ "facebook", "twitter", "linkedin", "googleplus" ]
        } ]
    }
}

The example above shows the simple way of creating a "share this on XXXX" link in your email. However, many platforms require/allow you to pass in additional parameters. Therefore, you often also have to pass in extra properties with platform-specific settings:

{
    "from" : "info@example.com",
    "subject" : "Email with a share block",
    "content" : {
        "blocks" : [ {
            "type"      : "share",
            "label"     : "Tell your friends about us!",
            "align"     : "left",
            "icon"      : {
                "type"      : "rounded",
                "size"      : 32
            },
            "link"      : {
                "url"       : "https://responsiveemail.com/",
                "title"     : "Post title"
            },
            "description"   : "Optional prefilled text to share",
            "platforms" : [ "facebook", "twitter", "linkedin", "googleplus" ],
            "facebook"  : {
                "appid"        :   "123456789101112",
                "redirect_uri" :   "https://www.copernica.com"
            },
            "twitter"  : {
                "hashtags"     :   [ "responsive", "email", "copernica" ],
                "via"          :   "ResponsiveEmail",
                "attributes"   :   {
                    "tag"      :   "twitter click"
                }
            } 
        } ]
    }
}
You can’t perform that action at this time.