Semi-Automate Copy-to-Clipboard Case Study

A “copy-to-clipboard” automation is a web page with many formatted text and links that are easy to copy and paste into another application.

My list of links will come from a database, CSV file, JSON file, frontmatter, or a third-party API, depending on what kind of project I am building out. Once I have my list of links, my automation builds a nicely formatted message based on my link and a text template.

Django News

For Django News and Django News Jobs, I built a few copy-to-clipboard pages to automate writing our weekly tweets for social media and grabbing jobs for our newsletter.

Each newsletter has a title, issue, and description stored in our database, and I use a template like this snippet to build out our weekly announcements.

{% raw %}
🎉 The Django News Newsletter {{ object.issue }}

{{ object.issue.description }}

[django-news.com/issues/](https://django-news.com/issues/){{ object.issue.number }}#start
{% endraw %}

The result, once published on Mastodon, looks like this: mastodon.social/@djangone…

Copy-to-Clipboard v2

For my copy-to-clipboard v2, I added clipboard.js, a JavaScript library that can copy text with the click of a button instead of having to select text and then manually copy the text.

I recently added the elastic-textarea web component, which resized the text box to fit the text and improved the visual appearance of the text areas.

DjangoCon US

For DjangoCon US, we have a half dozen copy-to-clipboard pages, which build messages to announce talks on social media and build out the metadata we use in our YouTube videos.

Jeff Triplett @webology