Logo

dev-resources.site

for different kinds of informations.

A link site of your very own

Published at
11/17/2024
Categories
programming
applinksite
cpan
linksite
Author
davorg
Author
6 person written this
davorg
open
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.

cpan Article's
30 articles in total
Favicon
A link site of your very own
Favicon
App::cpx
Favicon
Combining calendars
Favicon
Installing CPAN modules from git
Favicon
Deploying Dancer Apps
Favicon
Feature release 1.36 of the Date::Holidays Perl distribution
Favicon
Building a tool to integrate Readwise.io highlights into my Zettelkasten via Perl
Favicon
Dist::Zilla::Plugin::GitHub::CreateRelease
Favicon
GitHub Organisations
Favicon
Mission (Almost) Accomplished
Favicon
Writing a CPAN module that talks to ChatGPT
Favicon
How to download cpanm in the portable way that supports Perl 5.8.1
Favicon
SPVM::IO 0.14 is released on Perl/CPAN
Favicon
Feature release 1.32 of Date::Holidays Perl distribution
Favicon
CPAN Module Tutorials
Favicon
cpanm - Installation of Perl Modules on User Directories 2022
Favicon
Wrapping a JSON API to access your personal data
Favicon
Highlighting members of the Perl family
Favicon
Create foo.a using Pure Perl and Archive::Ar
Favicon
Multiple ways to inheritance in Perl
Favicon
Taming the Moose: Classing up Perl attributes
Favicon
Some thoughts on Perl template processing
Favicon
Making Single-binary Release with pp
Favicon
The reports of Perl’s death have been greatly exaggerated
Favicon
Read The Fantastic Manual: How to get the most out of Perl documentation
Favicon
Failing to get product information from Amazon with Perl
Favicon
CPAN Release of TooMuchCode 0.18
Favicon
Fast Perl module installation with cpm
Favicon
CPAN installation as a test, with GitHub workflow
Favicon
CPAN Release of TooMuchCode 0.17

Featured ones: