DEV Community

Cover image for A link site of your very own
Dave Cross
Dave Cross

Posted on • Originally published at perlhacks.com on

A link site of your very own

When I first wrote about my pointless personal side projects a few months ago, I used the software I had written to generate my own link site (like a LinkTree clone) as an example.

I’m happy to report that I’ve continued to work on this software. Recently, it passed another milestone—I released a version to CPAN. It’s called App::LinkSite[*]. If you’d like a Link Site of your own, there are a few ways you can achieve that.

In all cases, you’ll want to gather a few pieces of information first. I store mine in a GitHub repo[**].

Most importantly, you’ll need the list of links that you want to display on your site. These go in a file called “links.json“. There are two types of link.

  1. Social media links. These appear as a row of icons across the top of your link site. I’ve covered most of the popular options, but if there are any more you need, just raise an issue against the repo.
  2. Standard links. These go to web sites, blogs and things like that. In every case, you’ll need the link and a title to display. You can optionally add a subtitle and a “new” flag (which will slightly change the way the link is displayed – to make it more obvious).

There are also a few bits of header information you’ll want to add:

  • Name
  • Default handle – this is displayed on the page, but also used as the default handle in your social media links
  • Image – presumably your picture
  • Open Graph Image – which is optionally added to the header of the site
  • The URL of your site – used for various SEO tags in the output
  • Description
  • Optional Google Analytics 4 Tag

Put all of that information into “links.json” and put the images in a directory called “img”. Fuller documentation is in the README.

Now you get to decide how you’re going to build your site.

Installed CPAN module

You can install the module (App::LinkSite) using your favourite CPAN installation tool. Then you can just run the “linksite” command and your site will be written to the “docs” directory – which you can then deploy to the web in whatever way you prefer.

Docker image

I build a Docker image whenever I release a new version of the code. That image is released to the Docker hub. So if you like Docker, you can just pull down the “davorg/links:latest” image and go from there.

GitHub Actions and GitHub Pages

But this is my favourite approach. Let GitHub do all the heavy lifting for you. There’s a little bit of set-up you’ll need to do.

  • Store the “links.json” and the images in a new repo in GitHub
  • Create a “.github/workflows” directory in your new repo and copy my “build.yaml” workflow into that directory

Now, whenever you change anything in your repo, your site will be rebuilt and redeployed automatically. There’s also a “run this workflow” under the “Actions” tab of your repo that allows you to run the build and deployment automatically whenever you want.

This is the mechanism I like best – as it’s the least amount of work!


If you try this, please let me know as I’d like to add an “Examples” section to the README file. Also, if you try it and have problems getting it working, then let me know too. It works for me, but I’m sure I’ve forgotten to cater for some specific complexity of how other people would like to use my software. I’m always happy to get suggestions on how to improve things – even if it’s just better documentation.

[*] My continued use of the new Perl class syntax still seems to be causing problems with the CPAN infrastructure. The distribution isn’t being indexed properly.

[**] This shouldn’t be too much of a surprise – I store pretty much everything in a GitHub repo.

The post A link site of your very own appeared first on Perl Hacks.

Top comments (0)