Josh Pigford
Posted on January 3, 2019
I'm using Sinatra to build a site and that site will have, among other things, a blog area that I'll infrequently post articles to.
What I'd ideally like to do is have a directory of markdown files that the articles are in and to publish a new article, I'd just add a new markdown file.
The main /articles
page would loop through that directory and pull the title from the markdown file's metadata.
---
title: This is my title
excerpt: This is an excerpt from the article
---
So, what I'm not sure of here is how to approach this. How would I loop through a directory of markdown files and properly display them?
FWIW, I'm using a "classic style" Sinatra app here.
💖 💪 🙅 🚩
Josh Pigford
Posted on January 3, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
metaprogramming Using meta-programming in Ruby to build a REST API from a JSON file
October 21, 2024