looking at the interpreted microformats for a post, in bat
Like h-card, h-entry provides an attribute vocabulary. While h-card focuses on people and organizations, h-entry describes shared content — blog posts and comments in particular, but you could expand it as far as you like. Want to generate a feed of git commits? You could use h-entry to describe a commit!
[!NOTE] But I want to try Webmentions!
You totally can!
I plan to examine Webmention — the mechanism behind replies, likes, reposts, etc. They’re the fun conversation part of IndieWeb after all. But I need to make sure that when I get to the conversation I have a clear understanding of who is taking part — the h-cards — and where the discussions take place — the h-entries.
But you don’t need to wait for me. There are fine tutorials out there to walk you through the process. https://IndieWebify.me in particular tells you everything you need to know.
Fine. Let’s get on with it
IndieWeb entries identify themselves with the h-entry class. e-content marks the content of the entry. You could always mark the same element as both. In fact that’s basically what I’ve been doing for a while.
I’m trying to move away from that though. Let’s give it a little structure.
Time to focus on putting useful metadata in the article header. Might as well expose some of the Hugo templating as well.
The bare minimum
For IndieWeb purposes, we need to know at least two things about every entry:
Category and tag taxonomies get set in front matter.
What about cover images?
Many — but not all — of my posts include a cover image. Cover images should almost definitely be u-photo. There’s a lot of image processing with it though. To make a long story short — too late! — I’ll just show the microformat-specific addition.
Yep, that’s a post header all right. What about validation? Did I get the microformats right?
Examining my microformats locally
I know I can validate my h-entry at IndieWebify or copy and paste to https://microformats.io, but I want to look at this stuff from the shell. Preferably with a single command. Ideally with something I can stash in my Pyinvoketasks.py file.
I mainly want a dump of microformats found in a given URL, in a format easier for me to read than JSON. Here’s what I came up with.
I got carried away. This could have been its own post. Oh well. It’s like a two-for-one deal!
I need different formats for different purposes, so I import Python libraries for YAML and TOML along with the standard library JSON support.
Sometimes microformat info is a wall of text. Quite often, in fact, since e-content includes the full content of any post. shorten_properties uses textwrap to keep large text properties from overwhelming me.
Now that I have the support code I need, it’s time for the Pyinvoke task.
I could have made this a small script, but I’m pretty sure I’ll check microformats routinely while working on the site. Makes sense to have it readily available.
Let’s try out my new mf2 task.
What about default JSON output and letting mf2util interpret the results?
Nice. I can tidy it up a bit later. Probably end up using those mf2util functions. But this works great for now. And my h-entry looks good!
Examine microformats on other sites
Oh hey I can grab any URL. This handles another issue I had: trying to
examine microformats on other sites.