Need a WordPress website this weekend? Start here...

hRecipe – Semantic Recipes for WordPress (Google loves these)

(Reading time: 8 – 12 minutes)

I have an agenda, and this is definitely tipping my hand a bit early, but the iron is hot, so…

It’s time to strike!

New here?
Don’t run away! Website In A Weekend posts material ranging from completely basic to cutting edge. Poke around in the sidebar if this is a little too rarefied for your taste!

There’s something simmering away out there on the web which you’re going to need to know something about Real Soon Now. Because if you don’t, the people that do know about it are going to clean your clock on search results. And if you have any hope of semi-passive income, search results matter.

What is it?

Semantic web.

I’ve been working off and on for about a year on a little plugin that implements semantic styling for recipes. You can find it in the WordPress plugin repository. Just search on “hRecipe” in your WordPress plugin interface, it comes right up.

Last night (April 20, 2010) I checked up on Zarela Martinez, who was testing hRecipe plugin for WordPress, and thanked her for checking it out. She replied that she found it hard to use:

Dear Dave:

I’m trying it out but actually it is very hard to use. It requires lots of cut and pasting plus when you post the recipe all the ingredients and procedures run together and I have to separate them one by one. Also it should ask what category it is so one can save it right there without an extra step.

I’m sorry but I write cookbooks and this is not user friendly.

Thanks,

Zarela

Now that’s great feedback!

I agree, hRecipe isn’t that easy to use. My reply: “If you would recommend just one single thing that would make it more helpful for you, I’ll see about implementing that into the next release.”

Whence:

If you tell me why it is difficult I may be able to make suggestions. Right off the top of my head I think it should be a regular post without the sections and one could put in the separator like you do when you are writing a regular recipe for an article or book.

Here’s an expanded version of my email reply as today’s blog post.

Wow!

Most people don’t care at all about the details. But the details are important. Like cooking, little things can make a big difference.

There are two main issues to consider when displaying semantic recipes:

  1. Recipe display, which is the easiest, that can be handled with CSS styling.
  2. Recipe data entry, which is getting the recipe into the computer. This is “rope through a hole problem.” The difficulty is the same, it’s just who bears the brunt of the work. When it’s easy on the user, it’s really hard to program. Conversely, being easy to program usually involves conventions most users are not familiar with.

Let’s start with recipe display, the CSS.

No, actually, let’s give you a chance to jump right to hRecipe ingredients formatting.

If you’re still with me, then, here’s what’s involved.

Displaying semantic recipes

CSS stands for Cascading Style Sheets. It turns out that when “wrap” your recipe with CSS indicating it’s a “recipe class,” everything inside is treated as part of the recipe. There’s two reasons this is important:

  1. CSS let’s you choose a “style” that will render all your recipes exactly the same.
  2. Google (and other search engines) are evolving to understand this kind of CSS, which is known as a “microformat,” which defines what is known as the “semantic web.” More simply put, the hrecipe CSS gets you better search ranking. Since you’re putting your recipes on the web anyway, a little extra effort that you do helps.
  3. (MS Word doesn’t have this kind of capability built into it as far as I understand)

Ok, so much for now about CSS.

Entering semantic recipe data

Data entry is obnoxious, for everyone. Programmers, users, business owners, everyone.

In hRecipe, each part of the recipe needs to be classified according to it’s function. Further, some parts of recipes have lists: lists of ingredients, lists of preparation and cooking instructions. These lists can have an arbitrary number of items in them, and each item in the list can be very short or very long. Furthermore, each item in the list has it’s parts. “1 cup of flour” is 3 things. It’s a measure (1), a unit (cup) and the ingredient (flour).

The hrecipe microformat provides for designating each part of an ingredient list. The hRecipe plugin has not yet implemented this… it’s not a difficult problem per se, but there are a lot of “edge cases,” exceptions which make programmers stab their eyes out and users think “programmers are too smart for their own good.”

For example, translation on the user end is pretty simple. But how to deal with translation on the programming side?

And it’s important on the programming side for… parsing.

Let’s examine that word, “parse.”

What means?

From the Free Dictionary definition of parse:

parse (pärs)
v. parsed, pars·ing, pars·es
v.tr.

  1. To break (a sentence) down into its component parts of speech with an explanation of the form, function, and syntactical relationship of each part.
  2. To describe (a word) by stating its part of speech, form, and syntactical relationships in a sentence.
  3. 3.
    1. a. To examine closely or subject to detailed analysis, especially by breaking up into components: “What are we missing by parsing the behavior of chimpanzees into the conventional categories recognized largely from our own behavior?” (Stephen Jay Gould).
    2. b. To make sense of; comprehend: I simply couldn’t parse what you just said.
  4. Computer Science To analyze or separate (input, for example) into more easily processed components.

Our main interest is in Definition #4. As it turns out, these “easily processed components” correspond to the syntactical relationships defined in Definition #1.

As it turns out (you should check this yourself), parse can often be used as a synonym for “chop” or “cut.”

(Digression: the web has dumbed down common search terms because the vast majority of search results scrape or license one or at most very few sources instead of presenting their own work. Thus, a Google search for such terms results on a multitude of web pages all saying the same thing, in the same order, sometimes using the same words. You can’t do that in paper. It’s called “plagiarism.”)

Parsing your ingredients list

So, just as you might chop up a carrot, each item in the ingredients list needs to be chopped up into it’s parts.

Is this hard?

Well, not really, but as I hinted above, it’s tedious, time consuming and impossible to get right the first time.

For now, let’s not worry about that and focus on each list as a whole.

So instead of parsing an item in a list, we have to parse the entire paragraph!

One thing at a time… let’s back up a little bit and consider the whole hRecipe interface: 4 panes on a tabbed window, with several fields in each.

Each field represents an part of the recipe which can be defined using semantic CSS.

It turns out that it’s really simple for you to enter ingredients and instructions… if you follow a couple of simple – albeit totally unintuitive – rules. I say unintuitive, what I mean is these rules make perfect
sense to anyone who has written a parser.

When we get to the “Ingredients” field, there is no way for me (Dave) to know what you (Zarela) intend to prepare. That is, I can’t tell from behind the computer, separated in time and space, how many items in your ingredient list.

It turns out, this is the nature of the universe.

Rope through a hole

It’s basic thermodynamics really. There is one length of rope. Pull it through a hole and the length of the rope depends on which side of the hole you’re looking at. But the rope never changes length. TANSTAAFL.

There are several ways out of this predicament. Let’s look at the end cases:

  • I do little work, you do a lot.
  • I do a lot of work, you do a little.

Neither are very satisfactory. It turns out that using the semantic web correctly requires understanding a little bit about the semantic web, what it is, and the strengths and weaknesses implementations.

Let me restate that last paragraph: Supposing hRecipe was somehow written in MS Word. You would still need to learn some new stuff to use it correctly. There’s no way out!

Think of it this way: each semantic recipe is a little machine carrying little bits of recipe DNA that it can shoot into search engines.

But you have to load the machine. It’s different for each recipe.

Thus, data entry.

Getting back to lists of ingredients…

Upshot – 2 rules for fast hRecipe formatting

Here’s the two rules for helping me parse lists of ingredients or instructions:

  1. Each ingredient or step in the instructions should start with an “*”.
  2. Each ingredient or step in the instructions should be on it’s own line. Let it wrap if necessary, just don’t put a line break in (don’t hit the Enter key).

Alternatively, you can use raw HTML for these lists, but I don’t recommend it anymore. I’ll be stripping that out in the future.

This is all I have tonight. I’ll do more on this tomorrow and post it on the blog,

By the way, the blog has a LOT of material you will find useful for WordPress.

Thanks again for your interest, it helps keep my interest high.

—-

Thus concludes my email.

Whether Zarela chooses to use hRecipe on her blog is irrelevant. What’s much more important is that she asked me to explain the details.

That is critical. Because even if she doesn’t understand (or decides against taking the time), she has now been exposed to the notion of semantic web.

And so have you.

That’s way more important.

I have metric boatload of material coming your way.

Comments

  1. Dave Doolin says:

    I’m listening to some Purekane on Groovera’s Low Mercury… and racing the Red Queen.

    This is just a little taste of what I have up my sleeve. If you’re in this for the long haul, consider signing up for the newsletter, and definitely fasten your seat belt. Lot’s more coming.

    Who’s in?
    .-= Dave Doolin´s last blog ..Hostest With the Mostest – Being a good neighbor on shared hosting =-.

  2. It seems like the other “rope in the hole” with semantic web formats is usefulness v. ease of use.

    I imagine a recipe microformat could exist that was easy to use (for the person typing up their recipe), but not as useful in terms of how the information is marked up.
    .-= Sean *Deacon* Neprud´s last blog ..Dispatches from the Spice Mines =-.

    • Dave Doolin says:

      That’s another Small Matter Of Programming.

      Most of these things are relatively trivial for anyone who can scratch out a few lines of Perl or Bash, or knows HTML/CSS… but almost impossible for people who don’t.

      It’s a real conundrum.

      And the more you automate, the more you have to constrain the user’s flexibility. The key to it is finding the correct automation or correct paradigm for constraint.

      For example, Haiku constrains effectively.

      So does jQuery.

  3. Gurl says:

    Hey Dave.
    I’ve been using hRecipe for a week or so now (first post will go up Friday), and I usually just let it run together in the post. Then I take and hit enter IN the post writing area to separate the items in my lists. This doesn’t “break” The microformating, does it?
    Other than that one bit of “work” its easier than doing all the formatting to make it look good myself—by a LONG shot. Thanks for an great plug in… looking forward to your update on estimated reading time!
    .-= Gurl´s last blog ..Top 6 Worst Chores =-.

  4. Heather says:

    “*click*

    Heather, downshift and accelerate. We have work to do.”

    I’m listening. Just got back from one of the very few days off I’ll be taking for the next month or two. Game on.

  5. Ralph says:

    Dave,
    All you did was turn me off to finding anything more about hRecipe. I don’t have a clue how my post becomes a recipe or what I am making. At least Zarela has a cooking blog so maybe it is worth her while to struggle. Don’t tell me that I desperately need to implement some cryptic and inexlicable recipe into my blog and expect me to feel grateful and hurry to use it.
    .-= Ralph´s last blog ..The Opinion of Others – John Wooden =-.

    • Ralph says:

      Get your marketing hat on and kick the engineer in the ass.

      • Dave Doolin says:

        Definitely.

        Where did I lose you?

        Tell me and I’ll dig deeper.

        Because you’re not the only person I lost, not by far. You’re just the only person cantankerous enough to beef about it. That’s why I need you hanging around here.

        • Ralph says:

          What does semantic web smarts buy me? What does it do? Why don’t I need it now? What’s wrong with me (careful there). What in the world would make me interested in hresume? Am I looking for a job?
          .-= Ralph´s last blog ..You are the Star =-.

          • Ralph says:

            And should I just give up and learn HTML?
            .-= Ralph´s last blog ..The Opinion of Others – John Wooden =-.

          • Dave Doolin says:

            @Learn HTML: Yes, but not why you think. The reason you need to learn a little HTML is so that you’re familiar with the principles of markup. There is no reason you ever need to learn enough to build websites. That would be silly.

            But you do need a bit of “reading comprehension.”

            It’s not that difficult once you sit down and decide you’re going to do it. I offer this as proof: http://website-in-a-weekend.posterous.com/very-curious-case-of-memory-learning-desire-a


            @Semantic Web Smarts (.com) allows search engines to understand the context of the data. For example, suppose I went looking for information on brugmansia, because mine is about to croak.

            Well, it just so turns out that a certain Mr Carlson has reputation for knowing something about terminally ill brugmansia.

            Ultimately, all of our blog posts need to be hCard wrapped so that the search engine “knows” who the author is. But that’s a bigger battle than I can fight at the moment…

            Hrm…

            I bet I could write a plugin invoking add_filter in WordPress…

          • Ralph says:

            I can see that HTML is not difficult. At this point in my life, I only want to waste my time learning things that I absolutely have to know. So far workarounds have been sufficient (as far as I can tell). I am looking for people who have wasted the time – like you – to give me a heads up that I am missing something important.
            .-= Ralph´s last blog ..You are the Star =-.

          • Dave Doolin says:

            I’d say it’s worth your time putting together a simple web page from scratch.

            You will feel good when you get done, everyone does, and you will a much deeper understanding for relatively little investment.

    • Dave Doolin says:

      Ralph, you don’t need hRecipe right now.

      Perhaps you would be more interested in hresume: http://microformats.org/wiki/hresume

      hReview (http://microformats.org/code/hreview/creator) is interesting as well. Note that Matt Mullenweg, the CEO of Automattic (WordPress.com) wrote the underlying code for the XFN markup.

      And take a look at these hCards: http://microformats.org/#y2009-09-nice-hcards

      This stuff is coming. It’s unstoppable. It doesn’t matter what you or I or anyone else thinks about it.

      I’m running as fast as can… so that I don’t fall too far behind. Because there is no way to keep up much less get ahead. The best we can do in this community is watch what’s going on in the bigger tech world and adapt it for our use as fast as possible.

      What’s the alternative? Work at Starbucks?

      I’ve been holding back. I can’t do that any more. I’ll be continuing to post very basic and intermediate level material here, but the curve on the advanced is about to go vertical. You can always lean on me to break it down further! I’m here in part to get this stuff disseminated, and drag whoever I can, be they kicking and screaming, into the future as fast as I can.

      .-= Dave Doolin´s last blog ..Are You a Homeless Blogger? (You’re not alone) =-.

  6. Dave Doolin says:

    Following up on my remark about continuing to post basic material (http://website-in-a-weekend.net/building-traffic/hrecipe-semantic-recipe/comment-page-1/#comment-10454), a few moments ago I grabbed a screenshot for setting permalinks, a gaping hole in the Website In A Weekend curriculum.

    Earlier this morning, I added to the Install WordPress in 5 Minutes article, sending out a Hat Tip to Jennifer Jinright for clueing me in on fast WordPress installation technique I did not know about.

    Such updates and additions are usually invisible. But work continues behind the scenes.

  7. I didn’t know you had a recipes plugin and I’ll have to check it out – I was looking for one in the past. I mostly get the issue here – code doesn’t know the list of ingredients for a paragraph.

    I’ve been working with custom taxonomies in WordPress a little and am wondering if that would be a better approach for using recipes with WordPress …? They could be built into the theme.
    .-= Kim Woodbridge´s last blog ..Earth Day Every Day – Urban Composting =-.

    • Dave Doolin says:

      Kim, I suspect we may well have some grounds for informal collaboration here.

      Building into the theme is definitely one way to do it.

      Another way to do it is with custom fields. However, the custom fields interface is clunky. I’m thinking about moving some of my custom field handling into plugins.

      Tangent: I’m not sold on this notion that “too many plugins hurts page delivery time.” Mostly because 90% of the people writing about it don’t understand how a web server works, they’re repeating what they have read elsewhere.
      .-= Dave Doolin´s last blog ..Hostest With the Mostest – Being a good neighbor on shared hosting =-.

      • Well, I’m just getting started. A lot my work with taxonomies is in my head ;-) I think a sort of admin panel could be created – like a form to input the data for the entry and then displayed via css and the taxonomies. More work initially but a lot easier for the user.

        Custom fields would work too – but I think they are a pain and definitely clunky if you have more than a couple.

        I’m not anti-plugin at all – I’m just thinking of different ways this could be done. I have a huge videogame collection and my thoughts on taxonomies have been around creating a sort of collection of them in WordPress.
        .-= Kim Woodbridge´s last blog ..Giveaway – Win Any Three WordPress Themes from Templatic =-.

        • Dave Doolin says:

          Kim, the time to move on this is right now.

          Seriously, with Facebook’s announcement yesterday about using semantic data to build the social graph, this hRecipe article could not have come at a better time.

          I’ve put a bunch of other stuff on hold, I believe we’re looking at something with first-mover advantage, and I’m already in motion.

          This might cost me some short term page views, long term payback will *crush*.
          .-= Dave Doolin´s last blog ..On Literary Pranks & Other Forms of Gentle Mischief =-.

  8. Forgive me for asking what may wind up being a dumb question but would I be correct in thinking that this plug in could be used for anything that suited displaying in a recipe layout?

    So if one regularly posted things with a set format (like a daily one minute motivator for example) adapting this plugin might allow one to quickly publish a blog post in a whole load of semantic goo?

    I need to go back and look at this when I’m on the laptop but am I on the right track?
    .-= Eleanor Edwards´s last blog ..Thoughtful Thursday: The Power of Asking – Video post by @6aliens =-.

  9. Connections, connections, connections. This was a very helpful post – I never post recipes but the comments led me to the hReview microformat. I post lots of reviews! Looking into this now :)

    Cheers,
    r
    .-= Ricky Buchanan´s last blog ..Speak It! Keyboard-based Text to Speech for iPad/iPhone =-.

Trackbacks

  1. [...] but some tools make it easier. If you're a WordPress.org user, you can use a plugin like this one: hRecipe – Semantic Recipes for WordPress (Google loves these) | Website In A Weekend If you're a Chrome user, you can use this browser extension: [...]