Sharing: Editable options in template
Some sharing links allow you to include other details such as a title and hashtags. The full list you can use with Pipit Sharing is on the Template Reference page.
There are 2 basic ways to use editable content for these options.
Reserved IDs
This is the old method from v1.x. It is still supported.
You can add fields to your template with prefixed IDs. You would prefix your ID with sharing_
then the link type type_
and finally the option _option
. So it’s sharing_type_option
.
For example, Twitter links has an option called desc
. Your prefixed ID for desc
would be sharing_twitter_desc
.
<perch:blog id="sharing_twitter_via" type="text" label="Tweet via" divider-before="Twitter" suppress="true" />
<perch:blog id="sharing_twitter_tags" type="text" label="Twitter Hashtags" suppress="true" />
<perch:blog id="sharing_twitter_desc" type="textarea" label="Tweet" suppress="true" />
And you can output the link with the following (the app will add the options for you):
<perch:sharing id="twitter" />
With HTML:
<a href="<perch:sharing id="twitter" />" target="_blank">Share on Twitter</a>
Tag attributes
Introduced in v2.0
You can use any field available to you in the template by wrapping its ID with {}
. So if you have a field with ID title
, you would use {title}
:
<perch:sharing id="twitter" desc="{title}">