metalsmith / layouts

A metalsmith plugin for layouts
MIT License
116 stars 49 forks source link

Does the extension have to be specified in post front matter? #121

Closed AlansCodeLog closed 7 years ago

AlansCodeLog commented 7 years ago

Is it possible to just let it assume the default html extension?

I ask because I was switching my blog to metalsmith and when I tried to run it, it kept giving me a file not found on my partials (header, footer, etc). It looked like something was wrong with my build setup. I slowly transferred all my stuff over a working metalsmith example and eventually found it was the lack of an extension in the post front matter (layout: post instead of layout: post.html).

I could easily find and replace those instances but most static generators don't use an extension on their layout property in the front matter.

ismay commented 7 years ago

Since we use consolidate and allow for a lot of different templating languages we're not assuming a default extension. Which is why you have to specify one manually. Adding a layoutExtension option could resolve that. PR's are always welcome (though a merge isn't guaranteed of course).

AlansCodeLog commented 7 years ago

I ended up making myself a small plug-in to do it, just checks if an extension exists and if it doesn't, adds it, but leaves existing ones alone.

I'm not sure if I'll continue using metalsmith, but if I do I'll see if I can integrate it into your plug in. I think it'd be useful not just for markdown files imported from other static generators but just for testing different engines. I went through quite a few before I picked one and it was nice not having to do a find and replace on all my files each time.

ismay commented 7 years ago

but if I do I'll see if I can integrate it into your plug in

Cool, thanks! 👍