zaengle / craft-sharingintents
Generate social sharing intent URLs
Installs: 4 400
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Type:craft-plugin
Requires
- php: ^8.2 | ^8.3
Requires (Dev)
- craftcms/cms: ^5.0.0-beta.1
- craftcms/ecs: dev-main
- nunomaduro/collision: ^8.1
- pestphp/pest: ^2.34
- phpstan/phpstan: ^1.4
- roave/security-advisories: dev-latest
- symplify/easy-coding-standard: ^10.3
- vlucas/phpdotenv: ^3.0
This package is auto-updated.
Last update: 2024-12-16 12:23:00 UTC
README
Generate social sharing intent URLs
Requirements
This plugin requires Craft CMS 5.0.0-beta.6 or later.
Installation
cd /path/to/project
composer require zaengle/sharing-intents
./craft plugin/install sharing-intents
Sharing Intents Overview
Generate sharing URLs using web intents
Current providers:
- Twitter / X
Configuring Sharing Intents
Zero config :)
Using Sharing Intents
Templating uses craft.sharingIntents
which has 3 methods:
facebook()
, twitter()
, linkedIn()
all three take the same params:
url <string>
URL to share
description <?string>
optional description (only supported for twitter ATM, other providers won't break, it just won't affect the)
extraParams <?array>
K/V string pairs of other params to append to the url
{# get an intent URL #} {{ craft.sharingIntents.facebook(entry.url) }} https://www.facebook.com/sharer/sharer.php?u=https%3A//zaengle.com/blog/making-it-work-and-doing-it-right {# pass an optional description (only supported for twitter ATM) #} {{ craft.sharingIntents.twitter(entry.url, entry.description) }} https://twitter.com/intent/tweet?url=https%3A//zaengle.com/blog/making-it-work-and-doing-it-right&text=My+awesome+title {# arbitrary params! #} {{ craft.sharingIntents.linkedIn(entry.url, null, { foo: 'bar' }) }} https://www.linkedin.com/shareArticle?url=https%3A//zaengle.com/blog/making-it-work-and-doing-it-right&foo=bar
Sharing Intents Roadmap
- Release it
- Add more providers
Brought to you by Zaengle Corp