-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add mastodon #7
Comments
also fyi the link in this repo about, https://nickdiego.com/projects/social-sharing-block is a 404 |
Mastodon would be a great addition, but from my understanding, there is no uniform "share" link like there is for other social platforms. However, if you are aware of a way let me know, or feel free to open a PR.
Thanks, I guess I never published the page 🤦♂️ |
I investigated a bit and am not sure there is a JS-free way to do it cleanly yet. Perhaps something convoluted with contenteditable and CSS animations/transitions is possible but it already feels fiddly just typing that, and visitor would still have to fill in their server/instance domain. Here are two existing repos I found, they both use JS to construct the URL out of a server/instance input: Also in the prior art world, The docs page for Jan Boddez's Share on Mastodon plugin (see also WP plugin page, janboddez/share-on-mastodon) has some filter code to append WordPress tags as hashtags in the Custom Formatting section: add_filter( 'share_on_mastodon_status', function( $status, $post ) {
$tags = get_the_tags( $post->ID );
if ( $tags ) {
$status .= "\n\n";
foreach ( $tags as $tag ) {
$status .= '#' . preg_replace( '/\s/', '', $tag->name ) . ' ';
}
$status = trim( $status );
}
return $status;
}, 11, 2 ); …Terence Eden shares a custom formatting code snippet for add_filter( 'share_on_mastodon_status', function( $status, $post ) {
// Create a short preview of the post
$status = "New blogging from me!\n\n";
$status .= "\"" . get_the_title($post) . "\"\n\n";
$status .= get_the_excerpt($post);
// Remove the … forced by the excerpt and replace with the Unicode symbol
$status = html_entity_decode($status);
// Add a link
$status .= "\n\nRead more: " . get_permalink( $post );
// Add tags
$tags = get_the_tags( $post->ID );
if ( $tags ) {
$status .= "\n\n";
foreach ( $tags as $tag ) {
$status .= '#' . preg_replace( '/\s/', '', $tag->name ) . ' ';
}
}
$status = trim( $status );
return $status;
}, 10, 2 ); |
would love to see mastodon in here, any interest in adding it? if so, want me to ope a PR?
The text was updated successfully, but these errors were encountered: