Metal with care
A working static site generator using MetalSmith.
I was able to ramp up quickly thanks to Robin Thrift's getting-to-know-metalsmith series.
A lot of credit for this repo is owed to Robin Thrift who created the tutorials I followed and created the original MetalSmith-Demo, though under a different name: metalsmith-tutorial
With that said, I ran into a few issues during setup and the tutorial for part 1 (from April 2014) was outdated. I am just starting to toy around with MetalSmith, but I figured I would create this as a starter project to help myself, and others like me, to Metal with care.
-
Part 1
- the MetalSmith.build() method must be passed an error and/or success callback (this is up to date on the main MetalSmith README.md).
-
Part 2
- After completing adding of all of the instructions from Part 2, the build failed. I was missing a post.hbt file (There is a subtext in Part2 mentioning that you need to also create a post template that I missed while blindly following the large-text instructions.)
The index.md no longer builds to an index.html.. leaving only a directory listing when serving the build directory.I took way too long finding this out: the tutorials are on much much older npm packages, and with the current packages as of FEB 16 2015, you must set permalink: false, in any files you want to be carried over from src to build without manipulation.- The blog/index.html page was displaying incorrectly escaped content for posts due to using double, instead of triple, curly brackets.
-
Part 3
- No real issues
- Why U No Error when build fails? Why you DO success? If a success function is passed to .build(), it fires during the failed builds mentioned above. This is quite confusing.
- git
- node
- npm
git clone [email protected]:SgtPooki/MetalSmith-Demo.git destinationDirectory
cd destinationDirectory
npm install
node index
npm run metal # Build the site
npm start # Calls' npm run metal' and then http-server to serve the files.
- Create a slush generator.
- Create a yo generator.
- Add multiple server options for serving the static modules (but then what would I do with my What Now section...?)
- Add support for vhost middleware so this project can be added to any other site with a connect based server easily.
- Add watch support so we can rebuild without rerunning the
npm start
command.
Just a few other options off the top of my head:
- Node.js with connect
- Node.js with express
- Apache
- nginx
- SimpleHTTPServer
if,
- you have not received any errors
- you used the installation commands above
- you have a projectRoot/build/pages/about/index.html and similar files
- You can serve those files with
npm start
, then our work here is done. If not.. please see below.
If you're lost,
- please feel free to spend some time googling.
- email me with details about how you would like to bestow scrupulous funding upon me for my assistance.
- file an issue/question so I can address the cause of the installation commands above not correctly installing this project for you.