Sharing: Basic Examples
Generate a link:
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}">