So I have a bunch of cocktail recipes in a folder, each with a distinct name like screwdriver.json or adult-hot-chocolate.json with a correspondingly named image, and each recipe looks like this:
{
"name": "Adult Hot Chocolate",
"description": "Appropriately named 'adult hot chocolate', this recipe is one of the easiest and most common ways to spike your cocoa. To make it, you will simply add a shot of peppermint schnapps to your favorite hot chocolate and a delicious, warm drink is yours to enjoy.",
"github": "thesanjeevsharma",
"ingredients": [
{
"quantity": "2",
"measure": "oz",
"ingredient": "Peppermint Schnapps"
},
{
"quantity": "6",
"measure": "oz",
"ingredient": "Hot Chocolate"
},
{
"quantity": "",
"measure": "",
"ingredient": "Garnish: whipped cream"
},
{
"quantity": "",
"measure": "",
"ingredient": "Garnish: chocolate sprinkles or shaved chocolate"
}
],
"directions": [
"Gather the ingredients.",
"Pour the schnapps into a warm mug or Irish coffee glass.",
"Fill with hot chocolate.",
"Stir well.",
"Optionally, top with whipped cream and chocolate sprinkles or shaved chocolate.",
"Serve and enjoy!"
],
"image": "adult-hot-chocolate.jpg",
"keywords": [
"chocolate",
"peppermint",
"schnapps"
]
}
I want to create a layout and randomly pick one recipe and image to show on my website. I know how to do it if they were all just in one big YAML document, but it’s not clear to me how to tell Jekyll to parse separate files so I can reference one at random.
The other possibility is to combine them into one big json but then I couldn’t just pull down new recipes as easily from the original source.
Any help would be greatly appreciated!