Rich snippets on Google or Yahoo! usually include the number of replies (or reviews) for a given post. I confirmed with Peter Mika (SearchMonkey architect) that this information must be on the page in order for it to be displayed in the search results (having it on the tracker page for example is not enough). Since Drupal does not explicitly display this in the HTML output, we can simply add this information as part of the RDFa metadata present in the

tag of the page.

Rich snippet example

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scor’s picture

Status: Active » Needs review
Issue tags: +RDF, +RDFa
FileSize
4.29 KB

patch with tests

moshe weitzman’s picture

Status: Needs review » Needs work

should check for access comments permission?

Anonymous’s picture

Checks for 'access comments' permission.

Anonymous’s picture

Status: Needs work » Needs review
Dries’s picture

Curious -- shouldn't the permission span all the code instead just the meta tag in the page header?

moshe weitzman’s picture

next question. can this code live in a node_preprocess_node() instead of rdf_preprocess_node()?

scor’s picture

FileSize
4.39 KB

@Dries: we test for isset($variables['content']['links']['comment']['#links']['comment_comments']) which returns false if the user does not have access to comments.

@Moshe: do you mean template_preprocess_node()? I'm not opposed to it, and this remark could apply to more code in rdf_preprocess_node(). So far we've tried to keep the RDFa logic in rdf.module as much as possible but effulgentsia or sun mentioned it to the respective template function. At the end of the day you would still need to check whether the RDF module is enabled though. Would it bring much performance improvement?

The patch adds a line of documentation above number of comments annotation code.

moshe weitzman’s picture

I said node_preprocess_node, not template_preprocess_node. but i see your point about checking for rdf module. i am ok with rdf_preprocess_node.

mlncn’s picture

Status: Needs review » Reviewed & tested by the community

<meta about="/d7rdfa/node/1" property="sioc:num_replies" content="3" />

It looks beautiful, and it can count, too!

scor’s picture

rerolling patch.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

scor’s picture

Thanks Dries, nice to see you looking at these RDF issues - keep the ball rolling, there are a few more looking for your attention including the beast #538164: Comment body as field ;)

Status: Fixed » Closed (fixed)
Issue tags: -RDF, -RDFa

Automatically closed -- issue fixed for 2 weeks with no activity.