Latest Post

Improving the h-card in Grav

Apr 19, 2018

I spent a little time fixing up the way this site presents my h-card on the summary of blog posts. In case you're wondering, an h-card is a way of presenting information about yourself or your organisation on your website that makes it easy for other websites to identify you with your work, for example in webmentions.

The problem was that although the about-me plugin gives me a working h-card on my home page and the pages that present individual posts, the page that shows the most recent posts did not have an h-card, only a link to the home page, which does, and following that link is a step too far from some.

It wasn't that difficult. First I built the simplest possible h-card.

<div class="hcard" style="display:none;">
<a class="h-card" href=""><img src="" alt="Jeremy Cherfas" class="photo"/></a>

Display is set to none because it doesn't actually need to show on the page, just as long as it is there for other computers to read. I stuck that in partials/hcard.html.twig and also created partials/footer.html.twig cutting the relevant bit out of partials/base.html.twig. Finally, I edited partials/base.html.twig to include the h-card only when I am showing the summary of recent blog posts:

{% if page.header.title == "Jeremy Cherfas: Posts" %}
    {% include 'partials/hcard.html.twig' %}
{% endif %}

All this, of course, reflects the values for my site. Yours will vary, should you choose to go the same route. If you have other ideas, I'd love to hear about them.

Eat This Podcast

Using food as a vehicle to explore the byways of taste, economics and trade, culture, science, history, archaeology, geography and just about anything else.

Nominated for a James Beard Award in 2015 -- and again in 2016 -- and going from strength to strength.

Subscribe to the podcast in iTunes or by email and get a new episode every two weeks. And a newsletter to stave off the pangs between podcasts.

Older Posts

Profile picture

Jeremy Cherfas

I work as a freelance communicator. In essence, I see myself as a translator. I speak Science, and I speak English, and I work hard to make the two understand one another. Mostly, I like to help people tell their stories. I'm a biologist by training and by inclination, and my main joy is applying that to food and the agriculture and industries that supply it. I also have side interests in economics and many other things.