Change jekyll-archive ↔ Liquid-based category/tag

1 minute read

GitHub Pages build does not allow jekyll-archive, which creates a separate page for each category and tag. Instead, one can use Liquid-based category and tag archive pages, using URI bookmark to jump to the requested group on the long page. So if switching back to GitHub Pages from another hosting service or CI build, first change any links in Markdown (or HTML) that omit the #.

Make a git commit right before this, then use git diff to be sure the correct changes were made.

jekyll-archive to Liquid

Example: blog has links to category/sailing using jekyll-archive, but is switching to Liquid-based archive pages. Change all pages with a single command (be sure to have a backup!) by

find _posts -type f -name "*.md" -exec sed -i 's,](/category/,](/category/#,g' {} +

and

find _posts -type f -name "*.md" -exec sed -i 's,](/tag/,](/tag/#,g' {} +

Liquid to jekyll-archive

find _posts -type f -name "*.md" -exec sed -i 's,](/category/#,](/category/,g' {} +

and

find _posts -type f -name "*.md" -exec sed -i 's,](/tag/#,](/tag/,g' {} +

Switching between GitHub Pages and GitLab Pages

  1. copy files to new directory username.github.io as appropriate
  2. set .git/config to point to the new git host
  3. set _config.yml to point to the new git repo
  4. be sure your site has transferred (git push) to the new site. Access it at username.gitlab.io or username.github.io to be sure it works
  5. update DNS records to point at new host. If using CloudFlare CDN, consider CNAME flattening

For GitHub Pages:

example.com CNAME username.github.io
www         CNAME username.github.io

For GitLab Pages:

example.com CNAME username.gitlab.io
www         CNAME username.gitlab.io

Tags:

Categories:

Updated:

Leave a comment