1. Store Images / Placeholder Logic
Let’s say I’m building a website for a business that has multiple locations across the country. For each location, I want to display a photo. However, sometimes I might not have an up-to-date photo for a particular branch.
In that case, I’ll leave the image: field empty in the corresponding Markdown file for that location.
If the field is empty, the site should display a default placeholder image that I’ve chosen.
Or let’s say I have a blog, but I’m too lazy right now to find or create an image. Still, I want to publish my blog post right away…
In that case, I just leave the image: field blank, and a placeholder image will be displayed automatically.
2. Counting Stores by Tags
Still talking about those business locations: I use tags for each branch like “very friendly”, “very clean”, or “fast service”.
If I create, say, 50 Markdown files (one per branch), not every location will have all the same tags.
Now, I want to automatically display the number of branches that are tagged as “very friendly”, and how many are tagged as “very clean”.
For example: “There are (number) of stores that are ‘very friendly’ and (number) that are ‘very clean’.”
And, if I later add a 51st, 52nd, or 53rd branch, this count should automatically update to reflect the new data.