Copy Trove permalinks the easy way!

Copy Trove permalinks the easy way!

See that nifty green ‘copy to clipboard’ button in the image above? I added that to Trove, and I’m going to show you how.

You’ve found something exciting in Trove’s photos or journals zone and you want to save the link, what do you do? You probably just click in the browser’s location box and copy the url. Right? The problem with that is that you might end up with something like this…

1
http://trove.nla.gov.au/work/189805167?q=%28cat%29+%28nuc%3A%22ANU%3ANB%22+OR+nuc%3A%22ANU%3AADBO%22+OR+nuc%3A%22ANU%22+OR+nuc%3A%22ANU%3AIR%22+OR+nuc%3A%22ANU%3AC%22+OR+nuc%3A%22ANU%3AP%22+OR+nuc%3A%22ANU%3AM%22+OR+nuc%3A%22ANU%3AON%22+OR+nuc%3A%22ANU%3AOA%22+OR+nuc%3A%22ANU%3AANDS%22+OR+nuc%3A%22AAAR%22+OR+nuc%3A%22AAAR%3APS%22+OR+nuc%3A%22AFSA%3AR%22+OR+nuc%3A%22ANG%3AC%22+OR+nuc%3A%22ANG%22+OR+nuc%3A%22VNG%3AC%22+OR+nuc%3A%22VNG%22%29+&l-availability=y&c=picture&versionId=206512617

Ugh! The url looks like that because Trove adds all your search parameters to it. It’s possible to edit out all the search-related stuff without breaking the url, but there’s an easier way. Use the permalink, Luke.

Trove links follow a consistent, well-structured pattern. The permalink to the resource above is just:

1
http://trove.nla.gov.au/version/206512617

Much nicer, huh? The problem is that these permalinks (permanent links!) aren’t always obvious or easy to copy. Can you find the ‘Bookmark’ link in the screenshot below?

Trove screenshot showing permalink

Once you’ve found it you might think that if you click on it, the url in your browser will update to match. Ummm, no. Annoyingly, Trove redirects the beautiful permalink to something like this:

1
http://trove.nla.gov.au/work/153923228?q&versionId=167828884

So if you want to copy the permalink you have to manually select and copy the text, or right click and select the ‘copy link’ command from the menu. It’s not hard, but it’s just one more barrier – one more reason why people just grab the yucky old url.

Let’s fix it!

My tool of choice for this digital heritage hack is a userscript. Userscripts are just little bits of Javascript code that run in your browser after a web page has loaded. You can use them to change the way a page looks, or even functions. I’m going to be talking a lot more about userscripts in this series – I’m even going to help you create your own! – but right now we’re just going to see how to install and use a userscript that I’ve already prepared.

To run userscripts you really need to have a script manager installed. Userscript managers are available as browser extensions:

Just choose an appropriate manager and install it according to the requirements of your browser. I use Tampermonkey.

Once you have a script manager installed, adding a new userscript is easy.

I’ve created a userscript that adds a Trove green ‘copy to clipboard’ button just after the bookmark. One click and the permalink is yours to save and share! I’ve published my userscript as a gist on GitHub. Gists are just code snippets, or text files, that are quick and easy to create and share.

In the box below you can see what my userscript looks like. Don’t worry about the code at the moment – though I’ve added lots of comments in case you’re interested in how it works. Just scroll to the bottom and I’ll meet you there…

All you have to do to add this userscript to your browser is to click on the ‘view raw’ link in the bottom right corner. Your script manager will intercept the link and ask if you want to install it.

Tampermonkey screenshot showing installation

Just click ‘install’ and you’re done! Now Trove ‘versions’ will have a new green ‘copy to clipboard’ button. Try it out!

Tim Sherratt

Tim Sherratt
Historian and hacker

comments powered by Disqus