404.html file in gem based theme

Hey,
Any idea how to package a 404.html file into a them gem?
Tried
spec.files = git ls-files -z.split("\x0").select { |f| f.match(%r!^(assets|js|_layouts|_includes|_sass|LICENSE|README|404.html)!i) ,
but no luck.

Don’t think you can. I’m pretty sure Jekyll only reads the following files bundled in a theme gem: _layouts, _includes, _sass and assets.

There was a proposal to allow _data files, which I suppose this could be related to.
Your best bet to do it now would be to include a layout like _layouts/404.html and add documentation to your theme that someone would need to create 404.html with layout: 404 to use it.

Here’s a related discussion about allowing _data files into theme gems.

1 Like