Skip to main content


Share to Fedi Button Builder


Someone asked me if there was a share button for Friendica. I didn't really surprise me that I couldn't find one. I'd written one a while back for Mastodon, but it wouldn't connect to Friendica. I figured out why and rewrote my script so it can be extended to theoretically share to any Fediverse platform.

This is all done with JS on the client side. There's no proxy or connector service. I also set it up so you can load a minified script from a CDN.

Right now it only supports share buttons for Mastodon, any ActivityPub platform that uses the same post composer setup as Mastodon, and Friendica.

In fact, I shared this post you're reading right now using a button from the link below where you can configure buttons and grab the code you'd need to drop into your website.

@Friendica Support

randompenguin1.github.io/Share…

reshared this

in reply to Random Penguin

Once you enter your server URL and hit the "Share!" button it will try to go to the compose window for your account on that server, under the assumption you're already logged in there in the same browser. Then it will open the bare-bones Compose window, with the page title in the title field and the link in post body. Then you can write whatever else you want, add images, etc. before you post:

Friendica Compose Pop-Up

One downside is the "Submit" button won't close the pop-up window. It will refresh and show you the submitted post in the full web UI, which will likely be the mobile view in that small pop-up window. If you, as a website owner, don't want that experience for your visitors, you can change the script settings to open the share dialog in a new tab instead of a pop-up window. But I set it to default to a pop-up since that's how ALL the other social media platforms do it when you hit a share button.

Friendica Support reshared this.

in reply to VegOS

Yes there are several that don't say they work with Friendica and/or are implemented through a service. Which is why I wrote mine. Plenty of room in the 'verse for another option!

Friendica Support reshared this.

in reply to Random Penguin

@Random Penguin What kind I guess? I've been using the FediShare extension on FireFox, works great, although it could use some updating as it lacks some services like #wafrn

Friendica Support reshared this.

in reply to Kāpitan

I was specifically interested in share buttons you can put on a personal website so visitors to the site can easily share your content to their fedi accounts, not for me to share content to my own fedi accounts.

And I wanted it to look and work as closely as possible to how pressing a Facebook or X/Twitter share button works. Once someone has visited your website and told it to remember their instance they don't have to enter it again, so later when they hit the share button on your site it's as frictionless as sharing to any of the centralized social sites.

Friendica Support reshared this.

in reply to Random Penguin

@Random Penguin Nods, "This sounds like what Fedishare (abandonware sadly) does, but they do it via extension rather than being on the web page to get around the instance issue. In the extension settings, you set what instance your on for whichever Fedi services you use, limited to one instance per service (programmer's choice?), and if you're on a web page you want to share, you simply click on the Fedishare button in your toolbar followed by clicking on the service, and you get a pre-filled new post ready for final touches and posting or scheduling.

Not quite the same as having a button on a web page mind you, but it works pretty well, I've been using it for a few years across my various accounts here.

codeberg.org/Jeremmy/fedishare

Friendica Support reshared this.

in reply to Random Penguin

There is now an official Mastodon share button.
I like my implementation better.
This seems very...clunky.

blog.joinmastodon.org/2026/03/…

Friendica Support reshared this.

in reply to Random Penguin

Clunky to say the least, works with Mastodon and Mastodon alone, when it really isn't hard from the looks of it to support others... Well, one for all might be hard, but buttons for each service or compatible group.

Out of curiosity, how'd you get yours to work with both Mastodon and Friendica? If'n I plug my Friendica's instance into the either the official share button, or into that extension I mentioned, I get the same error, the extension solved this by having separate buttons for each.

Friendica Support reshared this.

in reply to Kāpitan

With mine you do need to create separate buttons for Mastodon and Friendica, but the script handles either because the URL they send to the platform differs because of the page it calls and the names of the form fields it has to populate.

Mastodon's is like this:
https://mastodon.server/share?text=Title Text%0A%0Ahttps%3A%2F%2Fexample.com%2Fsharedpage.htm

Friendica's is like this:
https://friendica.server/compose?mode=minimal&title=Title Text&body=https%3A%2F%2Fexample.com%2Fsharedpage.htm

Mastodon's stand-alone posting page is just /share and it only has one form field named "text" so ?text=. Friendica's is /compose?mode=minimal and it has a "title" field and a "body" field, so &title= and &body=.

My script uses a Share2Fedi class, so you just create an instance of that class for the platform and define the targetpage, titlefield, and bodyfield for the link constructor in the share() method.

So if you know what the name of the stand-alone compose page is for a platform, and you know the names of title field (if it has one) and the body field of the composition form, it should theoretically be possible to make it work with any platform.

This entry was edited (1 week ago)

Friendica Support reshared this.

in reply to Random Penguin

@Random Penguin Interesting, I'm looking at the API's in that extension I mentioned, and its actually using shorter versions of those, Friendica for example is /compose?title=Title&body=Url so I guess it eschews control over the share window, leaving it to the platform instead. And they have the API's for XMPP and 8 Fediverse platforms including Friendica and Mastodon if'n you want to stea... I mean borrow them.

Friendica Support reshared this.

in reply to Random Penguin

@Kāpitan Mine uses /compose?mode=minimal because that mode minimal part means it only shows the compose form and none of the rest of the Friendica UI. Otherwise, in the small popup window it would show the mobile UI for the responsive themes, or a UI that doesn't fit for the older non-responsive ones.

Unfortunately once you submit your post there's no way to make it close the pop-up and load the full site in a new window, it will just refresh in that popup with the full site. 🙁. Of course that's not an issue if you set my script to open in a tab instead of a popup.

Friendica Support reshared this.