generateShareLinks #
Generates
href
values for<a>
tags with thedata-platform
attribute, from the page's metadata.
Usage #
html
<!-- links -->
<link rel="canonical" href="..." />
<meta property="og:url" content="..." />
<!-- general -->
<title>...</title>
<meta property="og:title" content="..." />
<meta name="description" content="..." />
<meta property="og:description" content="..." />
<meta property="og:type" content="article" />
<!-- ... -->
<a data-platform="facebook" class="share-link">...</a>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
ts
import { generateShareLinks } from '@screaming/utils'
generateShareLinks()
1
2
3
2
3
html
<!-- output -->
<a
href="https://www.facebook.com/sharer/sharer.php?u=..."
rel="nofollow noopener noreferrer"
target="_blank"
class="share-link"
>
...
</a>
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Type Definitions #
ts
export declare function generateShareLinks(): void
1