shaz.io

Back to blogging

Feb 05, 2022
2 minutes

My last post was in Sept 2014, almost 8 years ago, so much has gone by especially the last 2 years with the SARS-CoV-2 virus pandemic.

So many blog posts in the can, I’ll have to back-date them and post them (especially the travel ones).

During the Lunar New Year 2022 holidays I converted this blog from Jekyll to Eleventy. Not quite pain-free, but it had to be done.

Thanks to:

The only hitch I had was to copy static HTML folders (for the slides) which I didn’t want processed, and to run as is, because they were generated by Keynote or Powerpoint.

I added this in .eleventy.js:

// async-friendly in 1.0+
eleventyConfig.on("eleventy.after", async () => {
    // copy all slides to slides in _site (pure HTML content)
    await fs.copy(
        path.join(INPUT_DIR, "slides"),
        path.join(OUTPUT_DIR, "slides"),
        { overwrite: true }
    );
});

Similarly for the gallery code, to pre-process the images for thumbnails, I added:

// async-friendly in 1.0+
eleventyConfig.on("eleventy.before", async () => {
    await createThumbnails(); // this calls the module that processes the thumbnails into _site
});