Share

Links to share the page by e-mail or on social networks.

When to use it

Links to share the page by e-mail or on social networks, at the end of an article.

When not to

Links to your own profiles on social networks: put them in the footer as a nav.

Accessibility

Plain links, each named for the network it shares to; they load no script and track no one.

See it live

The component library shows this component in the default theme, in every variant: open it in the component library

The share example as the component library shows it in the default theme

Fields

What the component’s dialog asks for. In a Doc, keyed rows start with the key; rows in order follow the order below. Each row is one item, its cells in the order of the fields.

Field

Key

Kind

Required

Network

network

One of several choices

Yes

Label

label

Plain text, one line

No

Icon (optional, instead of the theme's)

icon

An image from the assets, with its description

No

Share address (only for Other: use {url} and {title})

address

Plain text, one line

No

Networks, when there are no items (email, facebook, x, linkedin, whatsapp…)

networks

A value from a short list, or a setting

No

Variants

This component has no variants of its own; a theme can add some.

Warnings it can raise

The editor and the build say these when a block of this component needs a fix. All warnings are listed in the warnings reference.

Code

What it says

unknown_share_network

Unknown share network "{network}" was skipped.

In Google Docs

A component is a table. Its first cell names it; the rows below hold its fields. This is the example table:

share

email

facebook

x

linkedin

In a page file

In a site kept as a folder or in Git, the same component is a block of the page’s JSON file:

JSON
{
  "name": "share",
  "rows": [
    [
      "email"
    ],
    [
      "facebook"
    ],
    [
      "x"
    ],
    [
      "linkedin"
    ]
  ]
}

Markup and classes

What the component writes takes these classes, for a theme’s CSS: the component’s own name, name__part for its parts and name--variant for each variant (the variant’s plain name is there too).

Class

What it marks

share

The component

share__icon

A part of it

share__link

A part of it

share__link--icon

A part of it

The HTML the example above writes, as the component library builds it in the default theme:

html
<div class="share" role="group" aria-label="Share this page">
<a class="share__link" href="mailto:?subject=share&amp;body=https%3A%2F%2Fexample.com%2Fcomponents%2Fshare%2F" data-network="email" aria-label="Share on E-mail">E-mail</a>
<a class="share__link" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fexample.com%2Fcomponents%2Fshare%2F" data-network="facebook" aria-label="Share on Facebook">Facebook</a>
<a class="share__link" href="https://x.com/intent/post?url=https%3A%2F%2Fexample.com%2Fcomponents%2Fshare%2F&amp;text=share" data-network="x" aria-label="Share on X">X</a>
<a class="share__link" href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com%2Fcomponents%2Fshare%2F" data-network="linkedin" aria-label="Share on LinkedIn">LinkedIn</a>
</div>

Visitor texts

Texts it shows visitors, in the page’s language. Every one is in the visitor texts reference.

Key

Text

site.share.label

Share this page

site.share.on

Share on {network}

site.share.email

E-mail

site.share.facebook

Facebook

site.share.x

X

site.share.linkedin

LinkedIn

site.share.whatsapp

WhatsApp

site.share.bluesky

Bluesky

site.share.telegram

Telegram

site.share.reddit

Reddit

site.share.pinterest

Pinterest

site.share.other

Link

Extending it

Its files in SeedPage. A theme or a site changes the markup by giving a file of the same name (the Liquid part), and a new component can extend this one.

  • src/components/share.js
  • src/components/share/share.liquid