Andre Franca

Migrating my Jekyll Website to Codeberg Pages

Published: July 28, 2022
1025 words · 4 minutes to read
Tagged: #technology#indieweb#blogging#static-site#codeberg#github.

I’ve been really busy these days and haven’t made any posts. Despite having plenty of drafts for the blog, I couldn’t find time to sit down and write.

Fortunately, unlike any algorithm-based platform, this blog allows me to write at my own pace and as I wish. After all, there’s no financial support or, with all respect, any kind of obligations to readers. The dynamics of this blog is quite simple: I write what I want and like, while people who are interested in what I have to say, read it, and when they want, they interact with me by email or on fediverse. And this has been working very well.

Okay, back to the point that I’ve been 26 days without posting. I believe that one of the reasons that makes me post less - besides the time factor - it’s my publishing workflow. This blog is powered by Jekyll, where I write everything in a .md file, then I push the modifications to my git repository. If I want to add some picture, this process becomes even annoying, as I convert the image to lightweight and web-friendly format, strip the metadata, and upload it to my s3 storage.

Over the last week, I tried to improve this process by migrating to an opensource blog publishing platform called Writefreely. It is

a distraction-free writing environment, it federates via ActivityPub, so any ActivityPub-enabled service can follow your blog, bookmark your posts, and share them with their followers.

At first glance, it looked amazing. In fact I could focus on my writing, but it came with some cons:

Accepting that I’d continue with the same workflow for the present moment, I dedicated myself to my next task: migrate this static blog from github to codeberg.

Why to migrate? You might be questioning yourself.

There has been a whole heap of discussions about Github this month, mainly because of Copilot. For those who don’t know, Copitot is a proprietary service built on top of the hard work of the open source community with Artifical Intelligence (AI). It raises a number of important questions on which I will not be writing about in this post, but it certainly raises some flags for me.

I try when possible to use software and services from companies that I trust or that are closest to my values. That’s why I decided to migrate. Github, obviously, is a great tool, and I will keep using it in situations where I cannot opt-out, for instance, due to the lack of federation with git.

Okay, after this introduction, let’s talk about the migration itself.

Moving the repository was pretty straight forward. I created a new repo on Coderberg and pushed my local files.

If you want to migrate metadata like issues, releases and a wiki, you can use the Codeberg’s migration tool. This process is well documented on Codeberg’s Docs.

Here things get interesting…

I use Jekyll to generate this website’s static files, and the publishing it was easy, as Vercel simplified the CI building process. Altough, there’s no integration between Vercel and Codeberg.

At this point I thought about giving up and moving my repository back to Github, but fortunately Codeberg Pages allows us to easily publish my static files generated by Jekyll via Git on Codeberg.org. The process is not automatized, yet is not cmplicated. You just have to get used to it.

The first thing I did was to create a new branch called pages.

I decided to separate the main and pages branches in different local directories, so I would not mess things up:

git clone https://myrepo.codeberg.org websites-pages
git switch --orphan pages
git rm --cached -r .

Then I generate the static files to be added to the pages branch:

cd /path/to/your/repository/where/MAIN/branch/is
bundle exec jekyll build --destination /path/to/your/repository/where/PAGES/branch/is

then I pushed the new files to the new branch:

git add .
git commit -m "Initial commit"
git push origin pages

From this point, the website was working and accessible at https://username.codeberg.page/reponame/ and https://username.codeberg.page/reponame/@pages.

However, due to some hardcoded links in my static files, this messed up with basically all content, as well as the style.css file.

To fix this, I needed to configure my custom domain.

To use a custom domain, I created a file .domains in my repository with my domain.tld domain name.

In my case, because it is a zone root and Alias is not supported, I added the following DNS records:

A 217.197.91.145

AAAA 2001:67c:1401:20f0::1

TXT repo.user.codeberg.page

If CNAME is supported, you can just add this DNS record, instead of the entries above:

CNAME repo.user.codeberg.page

In a short matter of time the blog was up again. Codeberg Pages took care of generating the certificate with Let’s Encrypt, and everything was working as before.

Considerations

include:
  - .domains

Questions, comments or concerns?
I'd love to hear your thoughts! Please share them through email or Mastodon.

<~ Previous: Andre Updates: June, 2022

~> Next: Oops! I made a mistake!

Articles from blogs I follow around the world wide web

Answering machines

Google has been around for almost 25 years. That is an eternity when it comes to the digital world. And Google was not the first engine to go online: from AltaVista to Yahoo! to Lycos we had our fair share of search engines available to search the web. Ri…

via Manuel Moreale RSS Feed May 26, 2023

Surrender

Regular readers of my notes might have noticed that I have a little trouble being okay with wasting time. Ever since having kids, my time anxiety has driven me to look at every week as a puzzle to be solved. What is the most optimal way to cram all the pi…

via Rach Smith's digital garden May 22, 2023

Underline Your Links

Colored vs. underlined links by Jatan Mehta Jatan talks about why you should have underlined links to make things discoverable and accessible for your readers. Read Post → I’ve talked about this myself in the past and I wholeheartedly agree …

via Kev Quirk May 15, 2023

Generated by openring