Create middleware transforming responses to make singletype work with strapi-jekyll

System Information
  • Strapi Version: 4.3.4
  • Operating System: Fedora
  • Database: Sqlite
  • Node Version: 16.16.0
  • NPM Version: 8.19.2
  • Yarn Version: 1.22.19

I am trying to write a simple middleware to transport responses to work with jekyll.
Jekyll only uses collections, basically an array, to store data. With the strapi-jekyll plugin only the collections type is working which is mapped to the collection type in jekyll.

One workaround working with older strapi versions to use strapi singletypes was to just add a small middleware wraping single type responses in an array.

I tried to update the workaround to work with the current version of strapi but had no luck so far…
When starting strapi with the middleware strapi is starting up but when browsing http://localhost:1337/admin i get a error.

Anybody a idea how to make this work?

My error when browsing http://localhost:1337/admin

# ./config/middlewares.js
module.exports = [
    name: 'global::single_to_array',
    config: {
      enabled: 'false',
# ./src/middlewares/single_to_array.js
const singleName = "";

module.exports = () => {
  return async (ctx, next) => {
    await next();
    if (ctx.url.startsWith("/" + singleName)) {
        ctx.response.body = [ ctx.response.body ];