Sam Wilson's Website

T7: Twyne

Twyne is a the name of the software that I buid my website in. I started it in 2020, after finally getting sick of every other system of website building not doing what I want.

RSS feed icon. RSS feed for the "Twyne" tag


  1. The thunder has been thundering all morning here, and now the rain has come, making for a nice Sunday morning of good coffee and some code that’s making sense. It always feels better when the code makes sense. When it stops making sense (in about an hour, I suspect), I’ll return to cutting mortises.

    I’m adding a system of redirects to Twyne, so that Tags can be merged and their old IDs redirected to the new IDs, and Posts deleted and a correct 410 Gone response returned. I’ll also add a 404 log thing, so that a site admin can keep track of what URLs are missed by users, and if appropriate redirect them to a new page (good if a domain has been migrated from a different CMS).

  2. Everyone says you should’ve build your own blogging platform, because then all you’ll ever write about is the platform itself and no one wants to read that. It’s a fairly accurate idea, unfortunately. In my defence, I’m actually finding that having my own blogging (and photo) platform is saving me lots of time on things like copying photos to Commons and finding duplicates — so even if no one reads any of this, it’s still been worth making this thing.

    Anyway, one of the reasons I’ve always avoided building my own platform is that I’ve been worried about security. I’m feeling a bit better on that front now, because of using a bunch of common Symfony patterns and libraries, and also now because I’ve added two-factor authentication to it.

    This means that, after registering a new account and logging in, users are not able to view any page on the site until they’ve set up 2FA. Instead, they’re presented with a QR code, which they scan with a phone app such as Google Authenticator, and that app gives them a six-digit code that is entered in a text box under the QR code. This info is saved against their user account (and for simplicity, it’s only possible to have one such pairing at the moment), and next time they log in they need to provide three pieces of information: their username, password, and a six-digit code from the app.

    There are plenty of issues with my implementation: it forces 2FA; doesn’t have backup codes; doesn’t allow multiple devices; can’t easily be reset; and the login flow is likely quite confusing. I’m happy enough at the moment because none of these are security issues, and I’ll slowly work my way through fixing them. Primarily, I wanted to make the site more secure, and as all the users are either me or people I know personally, I can handle any usability issues.

    I think this is one of the great things about indieweb development: you build what you need, as you need it, and you don’t have to cater to some unknown simplified user. I do try to build everything here as general and reusable as possible (such that it should be possible for someone to set up their own Twyne-powered site, although I dare say that’s reasonably unlikely), but I no longer think it’s worth compromising on features that I actually want.

  3. I’ve added two-factor authentication support to Twyne. I’ve had this work done for ages, but just haven’t found time to actually merge and deploy it, but I’ve done that now.

    Perhaps at some point I’ll get back to sorting out photos.

  4. There’s been too much going on lately, for me to post anything on my blog. I’ve got nothing to say — but that has never stopped me in the past!

    I’ve been working on adding 2FA to Twyne, but it’s slow going because there’s too much else happening. I’ve got all the details figured out, and it’s basically working, I just need to find a day or two to get back and tidy up the patch. The rest of Twyne is going well, especially the uploading-with-duplicate-detection: it’s meant I’ve been able to process a good 20GB of stuff in my ~/life/unsorted/ directory!

    Mostly, Wikisource OCR has been top of the list. It’s pretty much done, and can be used while editing any Page namespace page on any Wikisource. See a random example here: https://en.wikisource.org/wiki/Special:Random/Page?action=edit

  5. I’ve added better pagination to Twyne post lists now. Dates were showing everything for a given month, but now if there’s more than ten there’s a link to page two and so on. It’s the same as was already working for tags.

    Now I can get back to adding 2FA support, and then fix up the editing form’s display on small screens (it’s been broken since I added the Select2 auto-completion for tags).

  6. I’ve recently added support to my website for linking posts’ tags to Wikidata entities. This means that each tag (which has it’s own URL at samwilson.id.au/Tnn where nn is the tag ID) can be linked to a Wikidata ID, and have a little table of facts displayed. This means that tags are no longer just strings, but are firmly linked to a meaningful concept — a tag such as ‘York’ is definitely the town in Western Australia and not the one in Yorkshire. No two tags are allowed to be linked to the same Wikidata item.

    The other part of this work was adding a lookup widget to the tag entry form field. Before, it was just a text box and tags had to be entered with semicolons separating them. Now, you start typing and a dropdown appears with suggestions firstly from existing tags on the site and then below them with labels and descriptions of Wikidata items. It makes entering new tags much easier.

    It’s great fun going back through my archives and linking all the tags, although it’s also highlighting the fact that I often create duplicate tags (e.g. misspellings, or Fremantle Railway Station vs Fremantle Train Station). To add a tag-merging system I first need to add a system of tracking and redirecting old URLs (something I should’ve added ages ago when I added the ability to delete duplicate posts).

  7. I’ve finally got the Twyne CLI client working, and it’s churning away uploading all of my past photographic archives (from Piwigo at the moment, 90 GB). The work for this has mostly been done before now, but I didn’t get back to it to actually tidy it up and set it running. Hopefully this will set me off further down the path of actually having everything a) in one place, b) organised, c) backed up, and d) actually useful.

    I’m not sure if I’ll tackle the export-to-Commons feature next, or sort out some of the UI bugs that are annoying me (like being able to zoom in on a photo). At the moment, I’m just poking through old photos and randomly fixing up metadata where I can; certainly there’s some UI tweaks that will help with that process.

  8. So now this blog has a system of posting and tagging and locations and photos and so on, it should be possible to a) walk; b) write; and c) take photos, without spending a great deal of time thinking about a better system of doing all that. I say it should be possible, because I’m yet to actually see that happen.