Sharing: Template Reference

To output sharing link, you can use perch:sharing tags in any template as long as it’s rendered at runtime.

Examples of functions that render templates at runtime:

Examples of functions that do not render templates at runtime:

To generate a link you would use a tag like the below (replace link_type with the actual link type):

<perch:sharing id="link_type">

The above would only generate the link, without any HTML. It is your responsibility to write the HTML.

To output a Twitter sharing link, for example, you would use something like:

<a href="<perch:sharing id="twitter">" target="_blank" rel="noopener">Share on Twitter</a>

Passing options via attributes

Some social platforms allow you to include additional details in your sharing links such as title and hashtags. You can specify these via tag attributes.

To specify static content:

<perch:sharing id="twitter" desc="Check out this video" via="twitter_handle">

You can also use dynamic content by wrapping the field’s ID with {}. If you have a field with the ID title, you would use {title}:

<perch:sharing id="twitter" desc="{title}">

Since v2.1, you can also mix static and dyanmic content:

<perch:sharing id="twitter" desc="Read: {title}">

Facebook:

Facebook sharing links don’t have any additional options.

<a href="<perch:sharing id="facebook" />" target="_blank">Share on Facebook</a>

Google+:

Google+ sharing links don’t have any additional options.

<a href="<perch:sharing id="googleplus" />" target="_blank">Share on Google+</a>

Twitter:

id Field type value
desc text or textarea Tweet text. May include hashtags and links.
tags text Comma-separated hashtags. Should not include “#”. Tags are added at the end of the tweet.
via text A Twitter username to associate with the Tweet. Should not include @. Appears as “via @username”.

Outputting the link:

<a href="<perch:sharing id="twitter" desc="Some text" via="twitter_handle" />" target="_blank">Share on Twitter</a>

Tweet length:

The length of your Tweet text should not exceed 280 characters when combined with any hashtags and via parameters. If it exceeds, Pipit Sharing will ignore all additional parameters.

Reserved IDs

v1.x used the concept of reserved IDs. You can find out more about this in the options section of the documentation.

<perch:blog id="sharing_twitter_via" type="text" label="Tweet via" divider-before="Twitter"/>
<perch:blog id="sharing_twitter_tags" type="text" label="Twitter Hashtags" help="comma-separated. No need to include #" />
<perch:blog id="sharing_twitter_desc" type="textarea" label="Tweet" max="207" />

Tumblr:

id Field type value
title text Title. Used in Text, Link, and Chat post types.
desc text or textarea Caption. Used in Photo, Link, Video, and Quote posts.
tags text Comma-separated tags. Should not include “#”. Tags are added at the end of the tweet.
posttype select Tumblr post type. Valid options are: text, photo, link, quote, chat, or video

Outputting the link:

<a href="<perch:sharing id="tumblr" title="Some title" />" target="_blank">Share on Tumblr</a>

Reserved IDs

v1.x used the concept of reserved IDs. You can find out more about this in the options section of the documentation.

<perch:shop id="sharing_tumblr_title" type="text" label="Tumblr Title" divider-before="Tumblr"/>
<perch:shop id="sharing_tumblr_desc" type="text" label="Tumblr Caption" />
<perch:shop id="sharing_tumblr_tags" type="text" label="Tumblr Tags" />
<perch:shop id="sharing_tumblr_posttype" type="select" label="Tumblr Post Type" options="Text|text, Photo|photo, Link|link, Quote|quote, Chat|chat, Video|video"  />

Reddit:

id Field type value
title text Title

Outputting the link:

<a href="<perch:sharing id="reddit" title="Some title" />" target="_blank">Share on Reddit</a>

Reserved IDs

v1.x used the concept of reserved IDs. You can find out more about this in the options section of the documentation.

<perch:content id="sharing_reddit_title" type="text" label="Reddit Title" divider-before="Reddit" />

LinkedIn:

id Field type Max length Value
title text 200 Title
desc text or textarea 256 Description
source text 200 Source of content. Not a URL. Example: “CSS-Tricks”

Outputting the link:

<a href="<perch:sharing id="linkedin" title="{postTitle}" />" target="_blank">Share on LinkedIn</a>

Reserved IDs

v1.x used the concept of reserved IDs. You can find out more about this in the options section of the documentation.

<perch:blog id="sharing_linkedin_title" type="text" max="200" label="LinkedIn Title" divider-before="LinkedIn" />
<perch:blog id="sharing_linkedin_desc" type="text" max="256" label="LinkedIn Description" />
<perch:blog id="sharing_linkedin_source" type="text" max="200" label="LinkedIn Source" />

Pinterest:

id Field type Value
desc text Description
media text or image URL to the image to be shared. If not set, the user can choose any image on the page. You can either use a text field and paste a URL in it, or use an image field and to upload or select one from your assets.
video checkbox Check if the media is a video

Outputting the link:

<a href="<perch:sharing id="pinterest" />" target="_blank">Share on Pinterest</a>

Email:

id Field type value
subject text Email subject line
desc text or textarea Email body. The URL is automatically added to the bottom of the body.

Outputting the link:

<a href="<perch:sharing id="email" />" >Email to a friend</a>

WhatsApp:

id Field type value
desc text or textarea Message body. The URL is automatically added to the bottom of the message.

Outputting the link:

<a href="<perch:sharing id="whatsapp" />" target="_blank">Share on WhatsApp</a>

Supported links:

All calendar links share the same options:

id value
from Required. Start date time - format yyyy-mm-dd hh:mm
to Required. End date time - format yyyy-mm-dd hh:mm
allday Set to true if it’s an all day event
title Event’s title
address Event’s address
<a href="<perch:sharing id="google_cal" title="Dentist appointment" from="2019-04-02 09:00" to="2019-04-02 10:00" />">Add to Google Calendar</a>
link