Semantic Blockquotes

Recently I deleted every post I had on this blog. Why? Because I learned that everything I knew about writing mark-up for my blog was wrong. Not really wrong, actually, but just uninformed. I realized this after reading a terrific article:

There are far too many bloggers and writers that don’t know a thing about writing for the web, technically speaking. Not knowing how-to is not an excuse when you take up a writing hobby or professional writing on the web.

For example, I was using the <em> tag when I wanted italicized text. Wrong. I thought I knew HTML, which I did for practical purposes, but I didn’t know how to use correctly. Then I read the article Semantics, HTML, XHTML, and Structure.

So I started over. I used <cite> when I was citing another blog. I started using <em> when I wanted emphasis (shocking!) and <strong> when I wanted yet more (stronger?) emphasis. And I started using blockquotes for actual quotations, not for indenting text.

Then I saw that Kunte wrote a plugin for WordPress that extracted the cite="" and title="" attributes from <blockquote> tags. Look at the blockquote above. Basically it’s taking the attributes of the blockquote to make a proper attribution: lovely, semantic mark-up.

I saw one place from improvement. For the citation below the blockquote text, the plugin wrapped the citation in <div class="source></div>. I thought that this might be more appropriately tagged with <cite>.

Have a look at the source code for the blockquote above and you’ll see what I mean. I’m using the revised plugin here and waiting to hear back from Kunte to work out how the plugin might be released. Interested?

I am also considering trying to make plugin for for the quicktags of the WordPress post editor. I don’t use the WYSIWYG editor in WordPress, and about half of my support time for my themes is given to help inexperienced bloggers remove destructive mark-up added by the WYSIWYG editor.

It’s a fantastic example of how not knowing how to write for the Web can hurt your blog.

Anyhow, I added some HTML tags and revised others in the quicktags.js file. Below is a screenshot of how my revised quicktags file works in my post editor screen:

Making the quicktags semantics-friendly in WordPress

I may try this quicktags.js file as a plugin, but until then it’s just here as an example of how—with a little knowledge and a few tools—our blogs can be better and more useful.

A Plugin?

Though I am still waiting to hear back from Kunte, I thought I might as well make this “informally” available. You can download my revision to Kunte’s plugin below.

Semantic Blockquotes v0.1 (4kb) for WordPress 2.0+

Please be aware that it is currently license-less and support-less until I figure out what exactly I should do with this—if anything. Where is an Emiy Post v2.0 when you need one?

Kunte was nice enough to scorn my thoughts on his post, Blockquotes in feed.

I suppose I stepped on his toes, so I should apologize for that. I tried to express just that in the emails I sent him, which I failed to do. Lesson learned: keep your shit to yourself.

Comments

  1. Alex Wang wrote:

    In your RSS feed, the blockquote source is not displayed, only the blockquoted text is in the feed.

    As for “correct” sematic HTML markups, I seem to recall a long-time debate on EM/I and STRONG/B tags.

    I used to write in LaTeX, and since then I’ve used only EM/STRONG and never I/B. In fact, I’m tempted to remove italics completely from my own style sheet—Chinese doesn’t, and shouldn’t, use italics.

  2. Scott wrote:

    The plugin is script-based, so it won’t work with the feed currently. Good point, though, and I’ll look into adding that as a possible aspect of the plugin.

    The best argument against using em for stuff that really isn’t being emphasized is for accessibility-related reasons. Like in my theme change logs I use i for the dates to set them off. I wouldn’t want voice synthesis applications blaring JANUARY 10TH!! 2006!!!

    Another good example is with the comment live preview. Type some text in the message box. Notice that the “Preview” header is bold? And the “You say:” text is in italics? I’m not emphasizing those, just enhancing the typography.

  3. Chetan wrote:

    Scott, thanks for improving. Every bit helps. Much appreciate it. And you have some excellent themes there, congratulations.

    Response to Alex’s observation: As for Blockquote cite display in feed, hover your pointer over the quotation and you’ll see the title as a tooltip. Something for the feedreader software makers to improvise on.

    [Sorry I couldn’t respond to your email before. I am right now in deep jungles of Borneo island, with barely able to connect to the civilized world.]

  4. Chetan wrote:

    Hi Scott, No, no, please don’t misunderstand. And you didn’t step on my toes :) . If you look carefully, the javascript is by Dunstan Orchard. I only wrapped it up into a Wordpress plugin. Having said that, and being a long time reader of Dunstan’s [now defunct] blog, I know how much the man digs into semantics.

    After I looked-up the code again, I realized that it’s okay to wrap it in a div and that it doesn’t break the semantics, simply because cite used here is a child element of blockquote, instead of cite used exclusively, like in a sentence.

  5. Chetan wrote:

    Strictly speaking, I didn’t want to use two cite tags for one quotation (one already defined in blockquote and one after the actual quote below), and so I gave precedence to the parent element because it contains a cite child element, and treat the attribution citation (which is possible by javascript) as presentation tag by using div.

  6. Scott wrote:

    OK, OK, point taken, I’ll leave it be. The last word is yours.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*

*