Brian's Blog Homepage
boy leaning over the shoulder of another boy to copy their work

There are few things more annoying than trying to copy a code sample and discovering you've missed the first line or grabbed half the paragraph below it. 

If you've ever written documentation, tutorials, or technical blog posts, you've probably watched someone struggle to copy one of your code examples. They carefully drag the mouse across the code, accidentally select a bit of surrounding text, paste it into their editor, and then wonder why it doesn't work.

It's a tiny frustration, but it's one that modern documentation sites solved years ago with a simple Copy button on every code block. Click once, paste anywhere, job done.

So I decided Joomla should have the same capability.

Introducing CopyCode for Joomla 6

This little Joomla 6 plugin quietly fixes that problem with a single click. CopyCode is a free system plugin for Joomla 6 that automatically adds a Copy button to every <pre><code> block on your website.

There's nothing to change in your articles and no special syntax to learn. Install the plugin, enable it, and every existing and future code block is enhanced automatically.

Whether you're publishing PHP, CSS, JavaScript, HTML, SQL, or any other code, your visitors can copy it with a single click.

Of course, no article about copying code would be complete without a code example. Please feel free to copy this one. I won't judge what you do with it.

<?php

// Step 1: Copy code from the internet.
$code = copyFromInternet();

// Step 2: Paste into production.
deploy($code);

// Step 3: Hope nobody asks how it works.
if ($manager->isWatching()) {
    echo "I wrote it myself.";
}

Why Bother?

Because documentation should be easy to use.

When someone visits your site looking for an answer, the last thing they want is to fight with text selection. They just want the code.

Removing those tiny points of friction makes your documentation feel more polished. Your visitors may never consciously notice the copy button, but they'll certainly notice when it isn't there.

Good user experience is often about eliminating annoyances before people have a chance to think about them.

It Doesn't Care How You Created the Content

CopyCode isn't tied to a particular editor or extension.

If your page contains a standard HTML code block, the plugin will enhance it. It doesn't matter whether the content came from TinyMCE, Markdown, a migration from another CMS, or was written by hand.

If Joomla renders a <pre><code> block, CopyCode will do the rest.

A Small Plugin That Solves a Small Problem

Not every plugin needs dozens of configuration options or a lengthy manual.

Sometimes the best software does one thing, does it well, and then quietly gets out of the way.

That's exactly what CopyCode aims to be.

Get It

CopyCode is free and open source. If your Joomla 6 site includes code snippets, it's an easy way to make life just a little easier for your readers.

You can download it, browse the source code, or contribute on GitHub: https://github.com/brianteeman/copyplugin

The best features are often the ones nobody notices until they're missing. If your Joomla 6 site publishes code snippets, this tiny plugin adds one of those small but surprisingly satisfying improvements.

J o o m l a !

Brian Teeman

Brian Teeman wearing glasses and clean shaven

Who is Brian?

As a co-founder of Joomla! and OpenSourceMatters Inc I've never been known to be lacking an opinion or being too afraid to express it.

Despite what some people might think I'm a shy and modest man who doesn't like to blow his own trumpet or boast about achievements.

Where is Brian?

custom converse sneakers in the joomla colour scheme with the text joomla rocks embroidered on the heel