hAtom and Bulletproof

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

hAtom and Bulletproof

Post by mattsches »

As some of you might already know, I'm into Microformats (MFs), and I recently decided that the addition of MFs cannot be achieved by means of one single plugin. One starting point would be templates. I'm thinking of starting a campaign to convince template maintainers to add - at least - hAtom to their templates, but this will probably come later. I know of a couple of bloggers who already enhanced their blogs with hAtom :D

As a first step, I offer hAtom for Bulletproof. The appropriate class attributes were added in the index.tpl and entries.tpl files. It was a matter of minutes, and I might have overlooked something, but as for now, my Firefox plugins (Operator and Tails) are reckognizing the entries. So, to me, it looks as if everything works fine.

If any of the Bulletproof maintainers wants to take a look and merge my changes (sorry I didn't post a diff), feel free to do so.

- Mattsches
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: hAtom and Bulletproof

Post by yellowled »

mattsches wrote:If any of the Bulletproof maintainers wants to take a look and merge my changes (sorry I didn't post a diff), feel free to do so.
I'm too tired to even make diffs right now, so I have saved these and will take a look at them on Monday. Anyway, thanks for the effort :)

YL
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Convince us. I need a value proposition. I think we could also use a diff - afterall, if you are trying to convince *US*, why should *WE* have to create it? :lol: :lol:

Seriously - it is probably worth looking into, but like YL, I am about out of energy for the evening, which also means the weekend (wife and kids ya know). I, for one, have absolutely no problem incorporating something into bp that provides value. I just do not happen to be that well versed in MF. So break it down, tell us why, show us the diff, and be prepared to work. You did, btw, use the latest svn for your mods, right?
=Don=
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Post by d_cee »

Although I don't use MFs myself, I know some bloggers find them very useful. Whether MF's should be incorporated into the stndard bulletproof template or whether it would be better to have an MF version available for download seems to be the question.

I personally would prefer an MF version for download but I'm willing to be persuaded otherwise :-)

Dave
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

d_cee wrote:I personally would prefer an MF version for download but I'm willing to be persuaded otherwise :-)
Depending on how much there is to patch, we could offer a "microformats upgrade" zipfile which would overwrite the necessary files in BP. Still haven't looked at the files, though :)

YL
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post by mattsches »

Ok, guys, you're right, I have to make this easier for you :wink:

In my opinion there are good reasons for including the hAtom mf to as many templates as we can. Let me, first of all, say that hAtom doesn't break anything, we're talking about simply adding some defined class attributes, and that's it. Since almost all class names in S9y start with serendipity_*, the hAtom classes shouldn't interfere with those.

Now, for the reasons, I just copy & paste the opinions of other people only because it saves me a lot of that precious time :wink: Please also take a look at whymicroformats.com and this blog entry.
http://microformatique.com/?page_id=138 wrote:hAtom is used to mark up feeds in HTML, rather than in separate files, such as RSS or Atom. Rather than replacing RSS or Atom, its aim is to use the schema of atom to create a standardized format for publishing blogs, and other feed based content in HTML. Because Atom and RSS feeds typically only list recent posts, hAtom is particularly beneficial for archiving posts.
hAtom might also be put to good use in future apps that we can't even imagine right now. There already are some Firefox extensions (Tails, Tails Export, Operator) that allow you to easily export blog data to other services, including events, addresses, and blog postings.

It might even be the case that mfs can help search engines to better parse your page because mfs provide information on your data that can be read by machines. I'm pretty sure Technorati is already having plans to do this (and so might Google).

So, as you see, mfs are a good thing, and they most probably don't hurt anybody. Besides, the changes to the templates are minimal, as you can see in the diff I created for ya:
index.tpl

Code: Select all

144c143
<             <div id="content" class="threemain layout3sbs_content">
---
>             <div id="content" class="threemain layout3sbs_content hfeed">
168c167
<             <div id="content" class="threemain layout3bss_content">
---
>             <div id="content" class="threemain layout3bss_content hfeed">
240c239
<             <div id="content" class="threemain layout3ssb_content">
---
>             <div id="content" class="threemain layout3ssb_content hfeed">
265c264
<             <div id="content" class="twomain layout2sb_content">
---
>             <div id="content" class="twomain layout2sb_content hfeed">
273c272
<             <div id="content" class="twomain layout2bs_content">
---
>             <div id="content" class="twomain layout2bs_content hfeed">
298c297
<             <div id="content" class="onemain layout1col_content">
---
>             <div id="content" class="onemain layout1col_content hfeed">
entries.tpl

Code: Select all

5c5
< <div class="serendipity_Entry_Date{if $dategroup.is_sticky} serendipity_Sticky_Entry{/if}">
---
> <div class="hentry serendipity_Entry_Date{if $dategroup.is_sticky} serendipity_Sticky_Entry{/if}">
11c11
<         <h3 class="serendipity_date">{$dategroup.date|@formatTime:$template_option.date_format}</h3>
---
>         <h3 class="serendipity_date"><abbr class="published" title="{$dategroup.date|@formatTime:'%Y-%m-%dT%H:%M:%S%Z'}">{$dategroup.date|@formatTime:$template_option.date_format}</abbr></h3>
15c15
<         <h4 class="serendipity_title"><a href="{$entry.link}">{$entry.title}</a></h4>
---
>         <h4 class="entry-title serendipity_title"><a href="{$entry.link}" rel="bookmark">{$entry.title}</a></h4>
23c23
<                             {$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a>
---
>                             {$CONST.POSTED_BY} <address class="author"><a href="{$entry.link_author}">{$entry.author}</a></address>
88c88
<                             {$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a>
---
>                             {$CONST.POSTED_BY} <address class="author"><a href="{$entry.link_author}">{$entry.author}</a></address>
119c119
<             <div class="serendipity_entry_body">
---
>             <div class="entry-content serendipity_entry_body">
134c134
<                             {$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a>
---
>                             {$CONST.POSTED_BY} <address class="author"><a href="{$entry.link_author}">{$entry.author}</a></address>
So, what do you say? I'd be happy if we at least create a patch, but IMHO we should add this to the default templates. Anyway, I leave the decision up to you. Don't hesitate to ask if you got any further questions.

Regards,
- Mattsches
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I have no objection, but am not totally convinced the intended benefits will ultimiately be realized.... but, the modifications are very minimal and see no real reason NOT to include them if it has some potential to help.
=Don=
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

@Mattsches,

Good work, in fact I've just implemented your changes on my own site (on the new template I'm working on, check it out). However, you need to add the trailing slash '/' on the abbreviation

Code: Select all

<abbr class="published" title="{$dategroup.date|@formatTime:'%Y-%m-%dT%H:%M:%S%Z'}" />
Otherwise your changes won't be valid XHTML. Next thing is to work out how to implement hcard...
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post by mattsches »

Oh, there's a new template in the works? Great news :D
carl_galloway wrote:@Mattsches,

Good work, in fact I've just implemented your changes on my own site (on the new template I'm working on, check it out). However, you need to add the trailing slash '/' on the abbreviation

Code: Select all

<abbr class="published" title="{$dategroup.date|@formatTime:'%Y-%m-%dT%H:%M:%S%Z'}" />
Otherwise your changes won't be valid XHTML. Next thing is to work out how to implement hcard...
Actually, you need an end tag for abbr, it's not an standalone element. Correct me if I'm wrong. But
<abbr class="published" title="{$dategroup.date|@formatTime:'%Y-%m-%dT%H:%M:%S%Z'}">{$dategroup.date|@formatTime:$template_option.date_format}</abbr>
looks correct to me.

Anyway, I've been thinking about where to add hCard. I will add it to my contact page, of course, and I also kinda added it to my blogroll. But I hesitate to mark up the author of each blog entry with hCard. At least in my blog, I am the only author, so I would have the same redundant contact information over and over again.

If you've got any questions regarding hCard or any other Microformat, I'm glad to help and/or discuss things. I've been using mfs for quite some time now (see my blog for example: hCard, hAtom, hCalendar, xFolk), but there definitely are some pitfalls :wink:

Regards,
- Mattsches
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

mattsches wrote:Actually, you need an end tag for abbr, it's not an standalone element.
I think you are correct.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

Don Chambers wrote:the modifications are very minimal and see no real reason NOT to include them if it has some potential to help.
I committed them to subversion just now. I don't see why we should maintain a different version - the changes are indeed minimal, and they don't hurt anyone. Doesn't even make sense to blow up the code with a template option to include these in my humble opinion.

YL
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I really don't know much about microformats..... YL change the bp svn to include the recommendations above.... but I have a question.

Is there anything magic about the <abbr> title time/date format? What was suggested, and what has been adopted for the entry date time format is this:

Code: Select all

@formatTime:'%Y-%m-%dT%H:%M:%S%Z'}
I personally think this could use a little visual separation with some spaces, but do not know if this is a format that needs to be preserved for some reason without spaces.

This is my suggestion for the time format:

Code: Select all

@formatTime:'%Y-%m-%d[SPACE]T[SPACE AND/OR POSSIBLY NO PRECEEDING "T"]%H:%M:%S[POSSIBLY NO SECONDS BUT DEFINITELY SPACE]%Z'
I've written my comments between square brackets for emphasis.... hopefully it will be understood.

Is this possible, or does it defeat the intended purpose?

Also, if abbr is not defined in css, firefox (perhaps other browsers) show a default dotted bottom border. Once again, is the purpose here to draw visual identification to this element, or is the primary purpose just generated code? I personally do not want entry dates to have the bottom border, even though I would not mind that for other abbreviations.
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I believe this date format is fixed in a RFC (2822?) and thus no additional spaces are allowed to prevent broken parsing. But I couldn't find the right doc for that, since I don't know the name of that exact dateformat...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I found it.... looks like the format needs to be preserved as-is:

http://microformats.org/wiki/datetime-design-pattern
=Don=
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post by mattsches »

Yep, you're both right, I guess. The title attribute provides for machine readability, so we have to use this date format here.
Post Reply