anderegg.ca

Follow-up on templating structured data

June 18, 2024

When I waffled about template-based XML, I mentioned that I discussed my issue with a friend. That friend, Mike Burke, wrote a follow-up post: On generating structured data from templates. It has several examples that demostrate the sorts of trouble you can get into when sticking data into a structured format. I agree with everything he’s said, but still feel that RSS/Atom feeds are likely “safe enough” to template.

Unrelatedly, Meta launched their Threads API today. I looked through the supplied sample app and found that they’re using the Pug templating system. I hadn’t heard of this before, but it’s similar to the htmltag library that Mike used as an example in his post. Even more than with syndication feed templates, I feel that almost all HTML on the web isn’t valid. Some might perfer to use templates like these, but I’ve been writing HTML for 30 years at this point… so I’ll probably keep doing that.

Those two instances aside, I will definitely continue using a library to generate JSON, XML, and especially SQL.