Jack Baty Daily

Daily notes from Jack about everything

A weather icon on daily posts

I have a shell script that grabs weather conditions from weatherapi.com. It returns a short summary of current conditions and the high/low temps for the day.

Example: Overcast 35.8. Low 29.2, High 36.6

I call the script most often via an Espanso shortcut, :weather but I also have a Tinderbox "Stamp" for it. The Tinderbox stamp puts the weather into the "Weather" user attribute and adds it to $DisplayedAttributes in the current note.

I recently added a second script that only grabs the icon number for the current conditions. The number corresponds to the file name of the appropriate icon file.

I thought it would be fun to display the icon along with the conditions, so I did. I have a new User Attribute to store the icon number. The export template that renders the day page generates an image tag using that value. Not much to it, really.

There's a folder full of images in /img/weather/day. A little CSS for tidiness and it looks like this:

Tinderbox is neat. Its syntax is...unusual...but I bet this would have taken me much longer if I were using, say, Hugo.

✍️ Reply by email