Let’s say I have a list of params written in yaml, like a little database. Eg. a list of cites with their respective temperature.
Let’s say I want to use part of that content in a post. For example I wanna show New York’s temperature compared to London temperature in a post.
What would be the best way to proceed in your opinion? Should I make a specific template? Can I use shortcode?
irkode
2
if you want to plave that anywhere between your normal markup text a shortcode is the way to go.
if you have a dedicated section at the same location and can target the content fe using frontmatter a partial template comes in place.
if you need the same layout in both variants, you may write a partial to do the layout and call that from a shortcode. so you can reuse the code.
that said, it depends on the exact use case and how it should look like in the final result.
if you need that on many pages, consider using the data folder and index fe the city using frontmatter.