Latest coffee intake: 75mg of Latte, 13 hours ago.

Personalizing My Blog

2023/12

In the past week, I made several personal modifications to my blog. These tweaks, while not heavily code-based, greatly enhance the personalized feel of the site.

Coffee Intake

Displaying information about my recent coffee consumption has always been a goal of mine. To track my caffeine intake, I have been using the HiCoffee app. Since the data was stored locally, I utilized Apple Shortcuts to export the latest entry to a remote API endpoint whenever I exit the app.

The endpoint is a serverless function defined on Next.js, which stores the data in a Redis instance. The only issue I encountered was Next.js using a stale version of the cache with @vercel/kv. Now, pages are rendered on-demand with server-side rendering (SSR) each time a request is made. I hope Next.js addresses this problem soon, so that a cache can be utilized and invalidated on-demand through the API endpoint.

Coffee Popout Screenshot

Last.fm

Another app I use for tracking is last.fm. I have been scrobbling for a long time, and I thought it would be cool to add a music card display in the footer to show what I am currently listening to. Implementing this feature was relatively simple. I obtained an API key from last.fm and queried the API using another API route.

Music Card Footer

Mostly JPOP, I know.

How I added the dynamic background