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 I write.

For Django News, I automate writing our weekly tweets for social media using this technique. 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

My v2 innovation was adding the clipboard.js JavaScript library to press a button to copy the formatted text to my clipboard instead of selecting all of the text so that I could then copy all of the text inside the text box.

I recently added the elastic-textarea web component, which resized the text box to grow or shrink around my formatted messages.

DjangoCon US

For DjangoCon US, we built several copy-to-clipboard pages, which build messages to announce talks on social media and later help build the metadata we use in our YouTube videos.