Announcing off-platform "Share to DEV" functionality
Tags: replit, meta, markdown, changelog
Published: 2019-04-26 16:17:45

I'm excited to share a pretty cool new feature with you!

We have shipped the functionality that allows anyone to create "Share to DEV" buttons with pre-filled DEV posts.

[repl.it](https://repl.it), a browser-based coding platform, has already implemented this in a really slick way! It's already live.

Here it is in action:

![example of replit to DEV](https://im4.ezgif.com/tmp/ezgif-4-b10d1be09868.gif)

DEV users have been able to embed repl.it instances for a while using a liquid tag: `{% replit @benhalpern/HelplessAdvancedKillerwhale %}`, but that functionality is now more seamless than ever.

That tag will result in this interactive repl:

{% replit @benhalpern/HelplessAdvancedKillerwhale %}

(Apologies for the contrived example 😄)

repl.it users can take what they've been working on, and generate a pre-filled DEV post in a snap. This makes it incredibly seamless for folks in the repl.it community to share with DEV and the broader software community. repl.it itself is a fascinating tool and this integration make collaboration and community easier and more powerful than ever.

We are also in touch with a few other platforms that are working on integrating the functionality.

### The coolest part (IMO) is how extensible it is

It works in a similar fashion to the “Share to Twitter” links you see around the web. It's a simple URL which accepts parameters readable as a `GET` request — for example, here's the Twitter button for a DEV post:

https://twitter.com/intent/tweet?text=%22Announcing%20off-platform%20%22Share%20to%20DEV%22%20functionality%22%20by%20@bendhalpern%20%23DEVcommunity%20https://dev.to/devteam/announcing-off-platform-share-to-dev-functionality-57j9

Our endpoint, however, accepts arbitrary markdown. So as long as it is typed in properly, you can "pre-fill" anything. For example, here's the DEV prefill for _this_ post:

https://dev.to/new?prefill=---%0Atitle%3A%20Wow,%20Share%20to%20DEV%20is%20really%20cool!%0Apublished%3A%20true%0Atags%3Ameta%0A---%0A%0ANice%20stuff%20DEV%20Team!%0A%0A%7B%25%20link%20devteam%2Fannouncing-off-platform-share-to-dev-functionality-57j9%20%25%7D

This URL could be made easily available as a button:

<a href="https://dev.to/new?prefill=---%0Atitle%3A%20Wow,%20Share%20to%20DEV%20is%20really%20cool!%0Apublished%3A%20true%0Atags%3Ameta%0A---%0A%0ANice%20stuff%20DEV%20Team!%0A%0A%7B%25%20link%20devteam%2Fannouncing-off-platform-share-to-dev-functionality-57j9%20%25%7D"><button>Share this post</button></a>

_FYI: The URL must escape characters including linebreaks (`\n`)._

Click that link and you'll be taken to a page with some pre-filled content. Any client can serve different versions of pre-fills.

Going forward, I'd like to use this API to build internal features for easily "quoting" comments, etc. on the site.

We could also build browser extensions for adding "Share to DEV" to Twitter, and perhaps GitHub, as we already have rich embeds enabled from each of those platforms. (That is assuming they don't build the functionality natively like repl.it and others are doing 😄)

We actually already have a Twitter browser extension that still works, but we have not touched in years. PRs welcome.

{% github thepracticaldev/devtwitter %}

The bottom line is that this functionality builds awesomely on top of the markdown/liquid tag groundwork we've laid, and should make interacting online as a software developer that much more fluid.

If you would like to implement "Share to DEV" functionality on your platform, be our guests. Depending on your use case, you may need to add a relevant liquid tag to our codebase. Feel free to open an issue or pull request related to any additional functionality you may need.

{% github thepracticaldev/dev.to %}

Happy coding!

_Update: The button is now live on CodePen as well!_

![](https://thepracticaldev.s3.amazonaws.com/i/m3v40uyttu3gcur7jqso.png)