Added basic microdata #3189

Merged
merged 3 commits into from Dec 29, 2014

Conversation

Projects
None yet
5 participants
@robertoschiavone
Contributor

robertoschiavone commented Dec 5, 2014

No description provided.

@parkr

This comment has been minimized.

Show comment
Hide comment
Member

parkr commented Dec 5, 2014

/cc @rodaine

@rodaine

View changes

lib/site_template/_layouts/post.html
- <h1 class="post-title">{{ page.title }}</h1>
- <p class="post-meta">{{ page.date | date: "%b %-d, %Y" }}{% if page.author %} • {{ page.author }}{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
+ <h1 class="post-title" itemprop="name headline">{{ page.title }}</h1>
+ <p class="post-meta"><time datetime="{{ page.date | %Y-%m-%d }}" itemprop="datePublished">{{ page.date | date: "%b %-d, %Y" }}</time>{% if page.author %} • <span itemprop="author name" itemscope itemtype="http://schema.org/Person">{{ page.author }}</span>{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>

This comment has been minimized.

@rodaine

rodaine Dec 6, 2014

Generally looks good, but itemprop="author name" would be technically invalid. From W3C:

The itemprop attribute, if specified, must have a value that is an unordered set of unique space-separated tokens that are case-sensitive, representing the names of the name-value pairs that it adds. The attribute's value must have at least one token.

This means you are defining two name values for the scope BlogPosting. I think your intent was to specify that span was the post's author and a Person whose name is the contents, correct? If you wanted to do that, you'd probably need to nest spans.

Instead, I'd follow the lead of schema.org's Article examples (which is the parent of BlogPosting):

<div itemscope itemtype="http://schema.org/Article">
  <span itemprop="name">How to Tie a Reef Knot</span>
  by <span itemprop="author">John Doe</span>
  This article has been tweeted 1203 times and contains 78 user comments.
  <meta itemprop="interactionCount" content="UserTweets:1203"/>
  <meta itemprop="interactionCount" content="UserComments:78"/>
</div>
@rodaine

rodaine Dec 6, 2014

Generally looks good, but itemprop="author name" would be technically invalid. From W3C:

The itemprop attribute, if specified, must have a value that is an unordered set of unique space-separated tokens that are case-sensitive, representing the names of the name-value pairs that it adds. The attribute's value must have at least one token.

This means you are defining two name values for the scope BlogPosting. I think your intent was to specify that span was the post's author and a Person whose name is the contents, correct? If you wanted to do that, you'd probably need to nest spans.

Instead, I'd follow the lead of schema.org's Article examples (which is the parent of BlogPosting):

<div itemscope itemtype="http://schema.org/Article">
  <span itemprop="name">How to Tie a Reef Knot</span>
  by <span itemprop="author">John Doe</span>
  This article has been tweeted 1203 times and contains 78 user comments.
  <meta itemprop="interactionCount" content="UserTweets:1203"/>
  <meta itemprop="interactionCount" content="UserComments:78"/>
</div>
Fixed itemprop="author name"
You are right, I tried to oversimplify it. Also, {{ page.date | %Y-%m-%d }} doesn't output what I expected. I think it's fixed now, I tried the code with a couple of validators and everything seems fine.
@rodaine

This comment has been minimized.

Show comment
Hide comment

rodaine commented Dec 12, 2014

👍

parkr added a commit that referenced this pull request Dec 29, 2014

@parkr parkr merged commit 35a5af7 into jekyll:master Dec 29, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

parkr added a commit that referenced this pull request Dec 29, 2014

@tkrotoff

This comment has been minimized.

Show comment
Hide comment
@tkrotoff

tkrotoff Feb 3, 2015

Contributor

IMHO The HTML code with the microdata stuffs looks ugly.

Is there any added value to have itemscope itemtype="http://schema.org/BlogPosting", itemprop="name headline", itemprop="datePublished"...?
From what I have heard it does not help for SEO and the format might change in the future.

Contributor

tkrotoff commented Feb 3, 2015

IMHO The HTML code with the microdata stuffs looks ugly.

Is there any added value to have itemscope itemtype="http://schema.org/BlogPosting", itemprop="name headline", itemprop="datePublished"...?
From what I have heard it does not help for SEO and the format might change in the future.

@rodaine

This comment has been minimized.

Show comment
Hide comment
@rodaine

rodaine Feb 3, 2015

From what I have heard it does not help for SEO and the format might change in the future.

Hm, where did you hear that?

HTML alone has no context of what it contains, so annotating it with this information helps non-humans interpret what is on the page. At the surface level, I'd imagine the "SEO value" would be the improved rich snippets; personally, I like to see the date published on a news or blog article in the SRP so I know if it's still relevant. It also apparently bumps up your rank on the SRP, too.

As for format change, the spec is living just like HTML, et al. I'd be more concerned if it was stagnant and didn't evolve over time.

Aesthetically, I will have to agree it's clunky and messy. However, the HTML is for the computer to read, just as minified CSS and uglified JS are as well.

rodaine commented Feb 3, 2015

From what I have heard it does not help for SEO and the format might change in the future.

Hm, where did you hear that?

HTML alone has no context of what it contains, so annotating it with this information helps non-humans interpret what is on the page. At the surface level, I'd imagine the "SEO value" would be the improved rich snippets; personally, I like to see the date published on a news or blog article in the SRP so I know if it's still relevant. It also apparently bumps up your rank on the SRP, too.

As for format change, the spec is living just like HTML, et al. I'd be more concerned if it was stagnant and didn't evolve over time.

Aesthetically, I will have to agree it's clunky and messy. However, the HTML is for the computer to read, just as minified CSS and uglified JS are as well.

@tkrotoff

This comment has been minimized.

Show comment
Hide comment
@tkrotoff

tkrotoff Feb 3, 2015

Contributor

I will have to agree it's clunky and messy

Thanks for the links, I was not aware you could do all this with microdata. Kind of a necessary evil.

Contributor

tkrotoff commented Feb 3, 2015

I will have to agree it's clunky and messy

Thanks for the links, I was not aware you could do all this with microdata. Kind of a necessary evil.

@tkrotoff tkrotoff referenced this pull request in tkrotoff/osteo15.com Feb 16, 2015

Closed

Ajouter les microdonnées (=microdata) #3

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.