Questions tagged [metalsmith]

Metalsmith is an extremely simple, pluggable static site generator.

Overview

Metalsmith is a pluggable static site generator.
All its is handled by plugins. You simply chain them together.

Example for a simple blog :

Metalsmith(__dirname)
  .use(markdown())
  .use(templates('handlebars'))
  .build();

Here is a list of the available plugins :

  • AUTOPREFIXER : Automatically add vendor prefixes to CSS.
  • ASSETS : Include static assets in your build.
  • BRANCH : Run separate metalsmith pipelines on selected files.
  • BUILD DATE : Add a build date, for things like feeds or sitemaps.
  • CLEAN SCRIPT : Generate a script to cleanup the build directory, if you are adding more than just Metalsmith files.
  • COLLECTIONS : Group files together, like blog posts. That way you can loop over them to generate an index, or add 'next' and 'previous' links between them.
  • COFFEE : Compile CoffeeScript files to Javascript.
  • COPY : Copy and rename files.
  • DRAFTS : Hide any files marked as drafts.
  • ENCODE HTML : Easily encode HTML entities in any HTML file by surrounding target code in triple backticks.
  • EXCEPT : Omit attributes from each file's metadata.
  • EXCERPTS : Extract the first paragraph from the beginning of any Markdown file.
  • FILE METADATA : Add metadata on files based on a pattern
  • FINGERPRINT : Insert a hash of the content into the file name.
  • GULPSMITH : Use Gulp plugins in Metalsmith, or Metalsmith as a Gulp plugin. Useful for uploading files, reading less than an entire directory tree, using external front matter, etc.
  • HEADINGS : Extract headings from HTML files and attach them to the file's metadata. Useful for automatically building navigation for a document.
  • IGNORE : Ignore any files that match a pattern.
  • INCLUDE : Make other source files available as properties.
  • LESS : Convert LESS files to CSS.
  • MARKDOWN : Convert Markdown files to HTML.
  • METADATA : Load metadata from JSON or YAML files.
  • MORE : Stores the content before the "more" comment tag in HTML files.
  • ONLY : Filter out attributes from each file's metadata.
  • PAGINATE : A simple plugin that uses metalsmith-collections to create a paginated collection.
  • PERMALINKS : Apply custom permalinks and rename files to be nested properly for static sites, basically converting about.html into about/index.html.
  • PROMPT : Prompt the user for series of answers in the command line and add them to the global metadata.
  • REPLACE : Replace attribute values in each file's metadata.
  • SASS : Convert Sass files to CSS.
  • SHORTCODES : Render wordpress-esque shortcodes via templates.
  • STATIC : Copy public assets into the build directory.
  • STYLUS : Convert Stylus files to CSS.
  • TITLE : Automatically generate a page title from first heading in each file.
  • TEMPLATES : Render any file through a templating engine of your choice.
  • UGLIFY : Uglifies/minifies your JavaScript files
  • WATCH : Watching for file changes and trigger rebuilds.
  • WEBPACK : Bundle CommonJS, AMD and ES6 modules.

Links

59 questions
1
vote
1 answer

Metalsmith - static site generator - configuration

I'm new to Metalsmith. I'm looking to configure it in windows8. Previously I used Grunt js which can be configured easily and quickly (Clean and simple steps are given). I used Jade and Sass with Grunt js, that was a very helpful tool that I had…
Som
  • 270
  • 1
  • 13
1
vote
2 answers

can't get extremely basic metalsmith installation to build pages

Metalsmith portrays itself as a ridiculously simple static site generator. I'm trying to write the most basic of sites just to get myself familiar with the basics of the software, but I can't seem to get even that to build. Here's my folder…
tmountjr
  • 1,423
  • 2
  • 22
  • 38
1
vote
2 answers

metalsmith collections previous next

According to the metalsmith-collections docs it supports 'previous/next' links between members of a colleciton: A Metalsmith plugin that lets you group files together into an ordered collection, like blog posts. That way you can loop over them…
1
vote
2 answers

How do you run a bash script in metalsmith

How do you get metalsmith to run a bash script? Can you even do that? My build.js is pretty simple, but I want to delete something from the build folder after everything is compiled. var Metalsmith = require('metalsmith'), copy =…
Adam
  • 475
  • 5
  • 18
1
vote
1 answer

How do I use metalsmith-permalinks in a Handlebars template

I have collections set up and working properly. I am looping through a collection of projects {{#each collections.projects}}
1
vote
1 answer

Metalsmith and Contenful Sync

I have been using the metalsmith contenful plugin. I am wondering if maybe I have the idea of static site generators wring, but what is the purpose of this if I have to run a build every time something is changed on contentful. Is there a way to…
Anders Kitson
  • 1,413
  • 6
  • 38
  • 98
1
vote
1 answer

Metalsmith plugin: Why ist the tiny-lr server started twice?

I'm trying to write a metalsmith plugin that rebuilds files on file change and reloads the page via tiny-lr. Watching and rebuilding works fine, but when a file is changed, the tiny-lr server is started again – which results in an error because the…
Benjamin Buch
  • 620
  • 7
  • 15
0
votes
1 answer

metalsmith config to read only markdown files

I have a (deeply nested) ./src directory with a mix of various files, including some *.md files. I want Metalsmith to recursively find ONLY the markdown files. But at the moment the different configs I’ve tried copies ALL files into the static site,…
Ashley Coolman
  • 11,095
  • 5
  • 59
  • 81
0
votes
1 answer

Moleculer-Cli inspired project: how to use EJS instead of Handlebars

I'm trying to create some scaffolding tool to easily start a project the way I want. I like the way how guys from moleculer do it in their https://github.com/moleculerjs/moleculer-cli They use Handlebars so now I can do this in my template (for…
daremes
  • 15
  • 6
0
votes
0 answers

Handlebars/Node changing date format

While outputting a date field through Handlebars to HTML on the server-side, it's giving me a different format than what's visible in the API when debugging. I've tried using both double and triple braces for output. I need that pure UTC time. API…
doublejosh
  • 5,548
  • 4
  • 39
  • 45
0
votes
1 answer

Metalsmith doesn't escape output of Markdown + Nunjucks

I'm stuck with this problem. When I use Markdown + Nunjucks as explained in the metalsmith-in-place Wiki the output is wrong (see below). The default layout, note the safe filter (_layouts/base.njk): …
gremo
  • 47,186
  • 75
  • 257
  • 421
0
votes
1 answer

Metalsmith-collection not finding markdown files

I have a static website using handlebars and metalsmith. I can create a collection called carriers from my metalsmith config file but the plugin pattern ignores the markdown files so carriers is always empty My JS file has metalsmith config as…
H.Houssein
  • 23
  • 4
0
votes
1 answer

Using nunjucks includes with Metalsmith-in-place causing rendering error

I'am using Metalsmith with Nunjucks to create a static website. I have no issue creating a blog-like website, meaning creating a layout in which I could wrap some markdown content, using the metalsmith-layout plugin. But I would like to create some…
Thibault
  • 424
  • 5
  • 5
0
votes
1 answer

How to order the list of entries using npm contentful integration with metalsmith?

Am trying to order the list of entries using contentful metalsmith example shown at https://github.com/contentful-labs/contentful-metalsmith-example/blob/master/build.js…
user769535
  • 11
  • 3
0
votes
2 answers

Viewing the metalsmith pipeline JSON

Metalsmith has an inbuilt way of displaying the pipeline contents, namely by using a simple function like: function(files, ms, done) { console.log('Files: '); console.log(files); console.log(); …
HaoZeke
  • 674
  • 9
  • 19