Migrating From Github to Codeberg

I recently decided to migrate my web site from Github to Codeberg, along with any repositories that I can (at some point).

There are plenty of existing blogs about how to do it, e.g. Ditching Github, but I'll put my two cents in, anyway.

  1. Go to Codeberg and create an account.
  2. Go to the plus menu in the top right and choose 'New repository'.
  3. Create a repository called 'pages' and make sure it is not marked as private.
  4. Clone the repo and check out the default branch.
  5. Run your static site generator with the repo as the output directory.
  6. Check in all the new files and push to Codeberg.
  7. Wait for the site to show up at: https://<username>.codeberg.page

For me the process was a bit more complicated because I was also switching from Jekyll to Pelican, so step 5 above took me a while.

One issue in particular was that Codeberg treats the name 'pages' in URL paths as a special tag. So, even though everything worked fine during testing, when the website was pushed to Codeberg, it would give 404's for anything in the 'pages' sub-directory. To fix it I made the following changes to the pelican config file.

PAGE_PATHS = ['pages', 'papyrus']
PAGE_URL = "papyrus/{slug}.html"
PAGE_SAVE_AS = "papyrus/{slug}.html"

A few additional changes of paths in MENUITEMS, and everything worked.

Actually, one other change I made was specifically for Mastodon verification. I added a third item to the SOCIAL tuples, which I then used as an attribute on the link.

From the Pelican config file:

SOCIAL = [
    ("Mastodon", "https://mastodon.nz/@Bleyddyn", "rel='me'"),
    ...
    ]

And in the theme's template:

    {% for name, link, attr in SOCIAL %}
        <li><a href="{{ link }}" {{ attr }}>{{ name }}</a></li>
    {% endfor %}