MetalsmithJS is Still Really Useful
TLDR; This post highlights a stack of useful plugins to rapidly assemble a static site generator thatās powerful and easy to program... even though the core tool has stopped growing.
I needed to pick a static site framework about two years agoĀ and I chose Metalsmith. Itās a lovely, minimal, open-source tool... however since summer of 2018 there hasnāt been any substantive work.Ā Segment officially handed it off. Scamper to the next shiny thing right!?Ā šæ
I manage a medium-sized (mostly marketing) website for my day job and rely on Metalsmith along with community plugins and still enjoy it. Iām not held back, itās simple to adjust, and a huge library of plugins have aligned on sensible norms.Ā šš» The architecture makes it very simple to add your own custom plugins and adjust data on itās way to be rendered.
What Is Metalsmith?
First, here are some useful quick links about the platform and plugins:
Official plugin list
Less official, bigger plugin list
List of resources
Slack channel
Frontmatter explanation
What Do These Plugins Do?
These plugins construct a pipeline to render a site without boilerplate or complexity.Ā Of course, the point of such architecture is to conform to your specific needs... but it never hurts to peek at someone elseās core blueprint.Ā
Most content should be editable in a CMS, pull it from Prismic.
Data from APIs needs to be available to templates/pages/layers.
One-off pages can be hard-coded markdown/YAML.
Essential Plugins
Assemble Components and Pages
metalsmith-layoutsĀ - page level templates
metalsmith-discover-partialsĀ - expose partials/includes
metalsmith-in-place - use data and partials in markdown
metalsmith-collections - organize grouped pages
Expose ContentĀ Beyond Markdown Files
metalsmith-json-to-files - convert JSON into pages
metalsmith-data - expose JSON data to templates
metalsmith-prismic-server - content viaĀ Prismic CMS
Handy Utilities
metalsmith-permalinksĀ - easy file named urls
metalsmith-aliasĀ - simple HTML aliases
metalsmith-fingerprintĀ - hash filenames for cache busting
metalsmith-i18n - simple internationalization
metalsmith-sitemap - generate a dynamic xml sitemap
Build Tasks
There are Metalsmith plugins for common build tasks like: SASS compile, JS concat/minify, etc. I recommend not using them and doing this stuff with a build tool like:Ā Gulp, Grunt, Webpack, etc. Thatās what itās for. Youāll probably need a build step to download and transform API data and reload the browser when done anyway. Use Metalsmith as a site generator, thatās what itās for.
I hope this is helpful!












