Jeffrey Harris

Converting this site from Jekyll to eleventy

The original template of this site was one that came with the script to convert a yaml array of my portfolio projects into a portfolio page. It was probably good back in the days when the template was originally designed, but I don't like it any more, so I'm switching to the eleventy static site generator, and their official starter. Obviously since it's the official starter, this has to look better, right?

Getting a clean working directory

Since I don't really want to lose all the existing git history, I'm starting with a git worktree and an orphan branch.

git worktree add ../11ty.jeffharris.us
cd ../11ty.jeffharris.us
git switch --orphan 11ty

Sweet. Now I copied the base blog files into my directory, added some scripts to my package.json file:

  "scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npx @11ty/eleventy",
"serve": "npx @11ty/eleventy --serve"
},

And fire up my npm run serve development server, making necessary changes to the _data/metadata.js file and updating my gitlab-ci.yml file. Static content transfers over easily.

Posts transfer over mostly the same, except for post categories. Maybe by the time you see this, it will be all set.


I did find that I had this code block that nunjucks comaplained about:

> $createdAt = Carbon::parse('2025-01-01 09:00:00', new DateTimeZone('America/New_York'))
= Carbon\Carbon @1735740000 {#5241
    date: 2025-01-01 09:00:00.0 America/New_York (-05:00),
  }

Do you see it? {#5241 looks to nunjucks like the beginning of a comment that never ends.

That's solved either by wrapping the blocks in a {% raw %}...{% endraw %} block, or by disabling Nunjucks on the page by adding frontmatter

templateEngineOverride: md

The things that need additional setup, that don't come right out of the box: