Migrating from GitHub Pages to Neocities
PermalinkThis morning started with a simple post from Luna:
It immediately reminded me that the avatar image I'm using for this website is a quickly edited photo that I meant to clean up and convert to WebP, but never actually got to complete the task. The first thing to do is to wipe the GPS coordinates from the EXIF metadata. All the images on this Eleventy project are in a img
directory, so I can run the exiftool
command once to process everything:
exiftool -gps:all= img/
From there, I could commit, push, and deploy the Git repository… but something is bugging me. GitHub requires the repository to be public, so the original temporary files with the metadata are still accessible. I can't leave things that way.
Looking for a GitHub pages alternative
The first service provider I want to check out is the Weblog service on omg.lol. I already use them for the Now page and status log. This could have been a pretty good solution if I were to start from scratch, but I got the Eleventy configuration that does what I want so that's not a suitable replacement.
I spend the next hour or so looking around, poking domain records to find what other people on social networks are using. Eventually I end up on a blog post by Dr. Matt Lee about migrating the Libre.fm blog. At the end of the article it mentions that he's hosting on Neocities. For now, I notice Cloudflare Pages and believe I could mirror my repository to Codeberg and have that publish the site. Unfortunately, Codeberg Pages requires the repository to be public, just like GitHub. I still make an attempt at using Gitea actions to get the pages on Codeberg, but quickly give up trying to create a simple action script to get around that.
Trying out Neocities
The simplest way to try out Neocities with an existing static site is to build the site locally, install the Neocities CLI, and use that to push the files:
cd ~/src/blorp.dev # move to the Eleventy project directory
NODE_ENV=production npx @11ty/eleventy --quiet # this is actually mapped as `npm run build`
gem install neocities
neocities push ./_site
Automating deployment with Gitea Actions
Publishing on Neocities is much simpler than using GitHub pages, mostly because of the much more basic authentication process. For a small site like mine, building a workflow artifact and requiring on all sorts of hidden manipulations to make it work is overcomplicated. Fortunately, there's a Deploy to Neocities action that does all the hard work:
mkdir -p .gitea/workflows
cat <<'SCRIPT' > .gitea/workflows/deploy.yaml
name: Deploy Eleventy site to Neocities
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v4
- name: Set up Node
uses: https://github.com/actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run build
- name: Deploy to Neocities
uses: https://github.com/bcomnes/deploy-to-neocities@v3
with:
api_key: ${{ secrets.NEOCITIES_API_TOKEN }}
cleanup: true
neocities_supporter: true
preview_before_deploy: true
dist_dir: "_site"
SCRIPT
Don't forget to grab the Neocities API Key and add it to the NEOCITIES_API_TOKEN
secret in the repository Actions > Secrets configuration, then push any changes to the site.
I probably still owe her a nickel.
- Previous: Dwyfor Tech Pas-Isel construction