DEV Community

Discussion on: The World's Simplest "Static Site Generator"

Collapse
 
weiji14 profile image
Wei Ji • Edited

Excellent post! Here's the oneliner bash loop ;)

for POST in *.md; do pandoc --to=html5 --output=$(basename ${POST%.md}).html --standalone $POST; done
Enter fullscreen mode Exit fullscreen mode

The $(basename ${POST%.md}).html strips out the .md file extension, and also removes the directory path (helpful if your posts are stored in a folder). I found this stackoverflow question a helpful guide.

I'd also recommend eleventy as a no nonsense static site generator.

Collapse
 
gypsydave5 profile image
David Wickes

Not seen the basename trick before - very, very nice.