Nunjucks permalink won't write to "_redirects" file

So, I have followed the JAMstack tutorial video:

At about 2:20:20 into the video, the topic of redirects has been introduced, the “src/redirects.njk” (see below) file has been written, and the file is saved, triggering a site build. A file named “dist/_redirects” is output in the video and thus is what I expect. However, my build will ONLY create a file, “dist/redirects/index.html”, which apart from the wrong location and file name, has the correct syntax.

I have copied everything else precisely in this video yet getting different output file location and name. The eleventy / nunjucks documentation has proven unhelpful, to say the least. How do I get nunjucks to output a file where I want it, with an underscore prefix, not in a sub directory with an index.html, not with any extension? I would rather hope a script to manually rename a file is unnecessary.


permalink: _redirects

{%- for item in news %}
/ /{{ }}/index.html 200 Country={{ }}
{%- endfor %}



Wow, this one is a bit strange. It looks like a recent change to Eleventy, in all honesty, based on this issue in the repo. Therefore, it’s going to need some jiggery-pokery to get it working. I think you’ll need to check out the Computed Data feature.