mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-22 15:02:18 +00:00
update draft
This commit is contained in:
parent
500f7d0c07
commit
c91b59395e
1 changed files with 20 additions and 11 deletions
|
@ -13,29 +13,29 @@ tags:
|
|||
- meta
|
||||
- serverless
|
||||
---
|
||||
I came across [Neocities](https://neocities.org) many months ago, and got really excited by the premise: a free web host with the mission to bring back "the fun, creativity and independence that made the web great." I spent a while scrolling through the [gallery](https://neocities.org/browse) of personal sites and was amazed by both the nostalgia and the creativity on display. It's like a portal that took me back to when the web was fun. It sounded like something I wanted to be a part of, so I signed up for an account... and promptly realized that I didn't *really* want to go back to manually crafting HTML like I did with the sites I created in the early 2000s. I didn't see an easy way to connect my preferred static site generator, and I'm kind of lazy, so I stopped.
|
||||
I came across [Neocities](https://neocities.org) many months ago, and got really excited by the premise: a free web host with the mission to bring back the *"fun, creativity and independence that made the web great."* I spent a while scrolling through the [gallery](https://neocities.org/browse) of personal sites and was amazed by both the nostalgic vibes and the creativity on display. It's like a portal back to when the web was fun. Neocities seemed like something I wanted to be a part of, so I signed up for an account... and soon realized that I didn't *really* want to go back to crafting artisinal HTML by hand like I did in the early '00s. I didn't see an easy way to leverage my preferred static site generator[^lazy] so I filed it away and moved on.
|
||||
|
||||
See, I was pretty happy with my existing publishing setup. I write posts in Markdown and commit/push those changes to GitHub. I've got [Netlify](https://netlify.com/) set up to watch my repo for changes, and when a `push` happens it springs into action. Netlify grabs the content of my repo, uses [Hugo](https://gohugo.io/) to render it to HTML, calls [Torchlight](/spotlight-on-torchlight/) to dress up the code blocks, and then serves the result through Netlify's global CDN. This process is automatic and reliable - and using an SSG like Hugo means I don't have to wrangle HTML with my bare hands.[^wrangling]
|
||||
[^lazy]: Also I'm kind of lazy, and not actually much of a web design person anyway.
|
||||
|
||||
[^wrangling]: Though, admittedly, I've spent most of my free time this last week tinkering with HTML templates and fiddling with CSS bits... but that was for fun, dangit!
|
||||
Until yesterday, when I saw [Sophie](https://social.lol/@sophie)'s post, [How I deploy my Eleventy site to Neocities](https://localghost.dev/blog/how-i-deploy-my-eleventy-site-to-neocities/). I hadn't realized that Neocities had an [API](https://neocities.org/api), or that there was a [deploy-to-neocities](https://github.com/bcomnes/deploy-to-neocities) GitHub Action which uses that API to push content to Neocities. With that new-to-me information, I thought I'd give Neocities another try - a real one this time.
|
||||
|
||||
But then I joined the [omg.lol](https://home.omg.lol/) community a month or so ago, and that exposed me to some brilliant web developers doing awesome things in the name of an [independent, personal web](https://indieweb.org/). Seeing what other omg.lol members were doing with their personal web spaces inspired me to see if I could do a bit more with mine... and I've done a *lot* of small housekeeping improvements in that time. I implemented full-text RSS feeds (and deployed a [self-hosted feed reader](/tailscale-serve-docker-compose-sidecar/#miniflux) to follow other blogs), switched to using [tinylytics](https://tinylytics.app/) for analytics (and a slick no-account-needed Kudos button on each post), did a lot of reorganizing things, and performed a lot of other little tweaks along the way.
|
||||
I'd been hosting this site on Netlify's free plan [for a couple of year](/hello-hugo/) and haven't really had any problems. But I saw Neocities as a better vision of the internet, and I wanted to be a part of that[^passion]. So last night I signed up for the $5/month [Neocities Supporter](https://neocities.org/supporter) plan, which comes with support for custom domains and more bandwidth than even a paid Netlify plan.
|
||||
|
||||
And yesterday, I saw a post from [Sophie](https://social.lol/@sophie) titled [How I deploy my Eleventy site to Neocities](https://localghost.dev/blog/how-i-deploy-my-eleventy-site-to-neocities/). Until reading her post, I hadn't realized that Neocities had an [API](https://neocities.org/api), or that there was a [deploy-to-neocities](https://github.com/bcomnes/deploy-to-neocities) GitHub Action which could use that API to push content to Neocities. With that new-to-me information, I quickly decided that I wanted to go ahead and make this change.
|
||||
[^passion]: Plus I love supporting passion projects.
|
||||
|
||||
Like I mentioned earlier, I didn't really have any complaints with Netlify, and I never came anywhere close to the bandwidth limits of the free plan. But I saw Neocities as a better vision of the internet, and I wanted to be a part of that. So I signed up for the $5/month [Neocities Supporter](https://neocities.org/supporter) plan so I could bring in my own domain *and* to support their vision.
|
||||
|
||||
Then I followed Sophie's instructions to obtain my Neocities API token and store it as a repository secret called `NEOCITIES_API_TOKEN`.
|
||||
|
||||
From there, I knew I'd need to make some changes to her workflow since I build my site with Hugo rather than Eleventy. I did some poking around and found [GitHub Actions for Hugo](https://github.com/peaceiris/actions-hugo) which would take care of installing Hugo for me. After some trial and error, I came up with this workflow:
|
||||
I knew I'd need to make some changes to Sophie's workflow since I build my site with Hugo rather than Eleventy. I did some poking around and found [GitHub Actions for Hugo](https://github.com/peaceiris/actions-hugo) which would take care of installing Hugo for me. Then I'd just need to render the HTML with `hugo --minify` and use the [Torchlight](/spotlight-on-torchlight/) CLI to mark up the code blocks. Along the way, I discovered that I needed to overwrite `/not_found.html` to insert my custom 404 page so I included an extra step to do that. And then I'd finally be ready to push the results to Neocities.
|
||||
|
||||
So after some trial and error, I came up with this workflow:
|
||||
|
||||
### The Workflow
|
||||
```yaml
|
||||
# torchlight! {"lineNumbers": true}
|
||||
# .github/workflows/deploy-to-neocities.yml
|
||||
name: Deploy to Neocities
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: 0 13 * * *
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
@ -53,24 +53,32 @@ jobs:
|
|||
name: Build and deploy Hugo site
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Install Hugo in the runner
|
||||
- name: Hugo setup
|
||||
uses: peaceiris/actions-hugo@v2.6.0
|
||||
with:
|
||||
hugo-version: '0.121.1'
|
||||
extended: true
|
||||
# Check out the source for the site
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
# Build the site with Hugo
|
||||
- name: Build with Hugo
|
||||
run: hugo --minify
|
||||
# Copy my custom 404 page to not_found.html so it
|
||||
# will be picked up by Neocities
|
||||
- name: Insert 404 page
|
||||
run: |
|
||||
cp public/not_found/index.html public/not_found.html
|
||||
cp public/404/index.html public/not_found.html
|
||||
# Highlight code blocks with the Torchlight CLI
|
||||
- name: Highlight with Torchlight
|
||||
run: |
|
||||
npm i @torchlight-api/torchlight-cli
|
||||
npx torchlight
|
||||
# Push the rendered site to Neocities and
|
||||
# clean up any orphaned files
|
||||
- name: Deploy to Neocities
|
||||
uses: bcomnes/deploy-to-neocities@v1
|
||||
with:
|
||||
|
@ -79,3 +87,4 @@ jobs:
|
|||
dist_dir: public
|
||||
```
|
||||
|
||||
I'm thrilled with how well this works, and happy to have learned a bit more about GitHub Actions in the process. Big thanks to Sophie for pointing me in the right direction!
|
Loading…
Reference in a new issue